Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Sunday, May 28, 2017

Raspeberry Pi - Connect to Wifi and send ip information to email



There is problem with the current setting of my Raspeberry Pi. Every time when it is started, I need to log into my account and connect to wifi. In order to use ssh on my desktop, I also need the ip information of the Raspberry Pi.

To automate this part, we need to write some autostart program. Essentially, we want to write scripts that can be executed upon the start.

In ArchLinux, it can be doen through systemctl. The documentation can be found here:
https://wiki.archlinux.org/index.php/systemd

It takes a while to read through all the sections. Some Useful examples can be found here:
https://www.freedesktop.org/software/systemd/man/systemd.service.html

Here is what we need to do:

Step 1: Create the script that need to be executed upon the start.

In our case, we want to have something like

#!/bin/sh
ip link set wlan0 down
netctl start home_wifi
ifconfig | mail -v -s "IP information" user@gmail.com


After editing the script, make it executable: chmod + x your-script

Step 2: Create a new service

Go to the /etc/systemd/system folder and create a new file
my-autostart.service

[Unit]
Description=Send ip information through email

[Service]
ExecStart=/path/your-script

[Install]
WantedBy=multi-user.target


Save the edit and enable the service by
systemctl enable my-autostart.service

Caveate
Though it can work, the configuration of the service may not be completely correct. It is better to have more fine control on it.


Sunday, April 30, 2017

Ubuntu - French Accents with US Keyboard Layout




Original Source : https://askubuntu.com/questions/333227/type-french-accents-with-us-international-keyboard

 
 Use the keyboard layout called English (international with Alt Gr dead keys). (Do this by going to System Settings > Keyboard > Layout settings, and then add the layout you want with the + button on the bottom.)
This way, the keys to input the characters ', ", `, ~, and ^ become "dead keys" while you hold pressed Alt Gr. After releasing the key combination with Alt Gr, no characters will be print (hence "dead"), but inserting a letter afterwards will yield a variation of the base character of the letter, in accordance with the dead key you pressed before; for example, é, ë, è, , and ê for e (respectively). (If you have no explicit Alt Gr key, just use the rightmost Alt key.)
So in summary, to insert a symbol
  1. press and hold Alt Gr,
  2. press the modifier key / key combination; e.g., `,
  3. release all keys pressed so far, and
  4. press the base character key; e.g., E for è.
Note: You can also enter an acute accented vowel by just pressing Alt Gr + (vowel).
(Source: this post on french Ubuntu forums.)

Saturday, November 29, 2014

How to add application to the launcher in Ubuntu





To add application to the launcher in Ubuntu, we need create a .desktop file in the /usr/share/applications

The .desktop file has the following format:



[Desktop Entry]
Name=pyCharm
Type=Application
Exec=/home/username/Programs/pyCharm/pycharm-community-3.4.1/bin/pycharm.sh
Terminal=false
Icon=/home/username/Programs/pyCharm/pycharm-community-3.4.1/bin/pycharm.png
NoDisplay=false
Categories=Development;IDE
Name[en]=pyCharm