"ignored_packages":
[
"Vintage"
]
Sunday, 26 April 2015
Sublime text in "command mode"
I really love Sublime Text 3, it's very easy to use and powerful tool at the same time. One of the things that recently started to bother me is "command mode". Some how doing things I have done many times before like selecting word or string multiple times CRTL + D, edit them and quit the selection with ESC which is enabling "command mode". Something has changed in my setup I think, because I'm pretty sure that this did not happen before and for some time I just closed the file and reopened to get back in "insert mode". But after all, the solution was quite simple. i takes you back to "insert mode".
Even better, at least in my case where I'm not using this "command mode", simply go to preferences -> settings-user and add following.
Monday, 13 April 2015
Taking and tweeting a photo with raspberry pi
At first I was going to create a timelapse of my cherry tree while blooming, then I decided to make a tweet once a day with a image.
Timelapse
Based on older post on how to make a Timelapse with Rapberry Pi camera module, I made small change. Rather than do a loop of x images I choose to use cronjob to run the script every 15 minutes. The script is simple and short.#!/bin/bash
DIR=/home/pi/cherrytree
/usr/bin/raspistill -w 1920 -h 1080 -rot 180 -n -t 1000 -o $DIR/$(date -u +"%Y%m%d-%H%M-%S").jpg
Next add to your cronjob your interval, I use every 15 min.
*/15 * * * * /bin/bash /home/pi/cherry.sh >/dev/null 2>&1
Twitter bot
There's more than one way to cook an egg... There are also many ways to make a twitter bot.I installed Twitter CLI
sudo apt-get install ruby-dev
gem install t
You will also have to create or have access to an twitter app to authorize the CLI interface.

Here is a simple script I use to take picture and tweet it. Every time I run this script, I just overwrite the image, but you can collect them by naming the file like in the script above.
#!/bin/bash
DIR=/home/pi/autotwitter
DATE=$(date -u +"%A %d %B %Y")
/usr/bin/raspistill -w 800 -h 460 -rot 180 -n -t 1000 -o $DIR/twitter.jpg
/usr/local/bin/t update 'Image of the day, '"${DATE}"'. #CherryBlossoms #raspberrypi #cli ' --file=$DIR/twitter.jpg
Once a day this script runs by cronjob at 12:011 12 * * * /bin/bash /home/pi/twitter.sh >/dev/null 2>&1
In addition to that, you can auto follow your followers in the same script by adding following line to the twitter script.
/usr/local/bin/t groupies | xargs /usr/local/bin/t follow
Friday, 6 March 2015
Tag cloud and list layout with css
What I wanted was to style my tags, (labels) which is an unordered list, so the look like the image below.
![]() |
| Tag list |
This is a simple unordered list, we need to remowe bullets and make it horizontal.
<ul class="tags">
<li class="tag">
<a target="_blank" href="#">css</a>
</li>
<li class="tag">
<a target="_blank" href="#">html</a>
</li>
<li class="tag">
<a target="_blank" href="#">python</a>
</li>
<li class="tag">
<a target="_blank" href="#">Demo</a>
</li>
</ul>
And here we have the css
ul .tags {
list-style: none;
}
.tags a, .tags a:visited, .tags a:active{
color: #ddd;
border:1px solid #ddd;
border-radius:5px;
text-decoration:none;
padding:3px;
margin:3px;
text-transform:uppercase;
font-size: 1em;
line-height: 1.2em;
}
.tags a::before{
content:'#';
}
.tags a:hover {
color: #fff;
background:#eee;
}
li.tag {
display: inline;
list-style-type: none;
}
Perhaps I'll change the layout of the labels in this site to.
--cheers
Saturday, 28 February 2015
Six tips to improve your Google calendar usage
Google Calendar is the favourite up-to-date organization tool. like other Google’s services, Google Calendar has flexibility which lets you work faster and more efficiently. With Gmail, separate calendars for work, school or personal affairs, keep them together in the same view, and share your calendar with colleagues.
1. Keyboard shortcuts
Navigating around a calendar should be fast and easy.
| Shortcut Key | Action |
| Navigation | |
| k or p | Moves your calendar view to the previous date range |
| j or n | Moves your calendar view to the next date range |
| r | Refreshes your calendar |
| t | Moves you to the current day |
| Views | |
| 1 or d | Displays your calendar in the 'Day' view |
| 2 or w | Displays your calendar in the 'Week' view |
| 3 or m | Displays your calendar in the 'Month' view |
| 4 or x | Displays your calendar in the 'Custom' view |
| 5 or a | Displays your calendar in the 'Agenda' view |
| Actions | |
| c | Allows you to create a new event |
| e | Allows you to view an event's details |
| Backspace or Delete | Deletes the event |
| ctrl + z / command + z or z | Undo last action (if possible) |
| ctrl + s / command + s | Save event (from event details page) |
| Esc | Return to calendar grid (from event details page) |
| Application | |
| / | Places your cursor in the search box |
| shift += or + | Focus on 'Add a calendar' text box under 'Other calendars' |
| q | Opens "Quick Add" |
| ctrl + p or command + p | Prints the current view |
| s | Brings you to your Google Calendar settings page |
| ctrl + ? / command + ? or ? | Brings up a menu of keyboard shortcuts |
2. Receive an email with your agenda
If your schedule is busy, you can receive your google agenda by mail, share it, modify it or duplicate it. Go to settings, Calendars tab, then click on the “Notifications” of the agenda.
![]() |
| Receive an email with your agenda |
3. Add a Different Time Zone
You can get Google Calendar to display multiple timezones. To change this, hit S to head to "Settings" menu. Under the "General" tab you can see "Your current time zone." Click on "Show an additional time zone," and then tick the box "Display all time zones."
![]() |
| Add a Different Time Zone |
4. Customise view the view of your Google calendar
Set the view of your calendar, depending on whether you prefer a display of “4 days, 5 days or more”. Choose between 2-7 days and 2-4 weeks.
Hit s for settings and scroll down to "Custom view"
5. View your tasks in your Google Calendar
Google Calendar allows you to view your tasks in your calendar. In the left pane, in "My calendars" check the “Tasks” box. Google Calendar allows you to assign a deadline to a task, which will be displayed in your calendar.
![]() |
| View your tasks in your Google Calendar |
6. Add public holidays to Google calendar
Integrate public holidays or special events to your Google Calendar. Depending on countries and cultures, the holidays or public holidays can be very different. In the left pane, click "Other Calendars" and "Browse interesting calendar".
![]() |
| Add public holidays to Google calendar |
Thursday, 8 January 2015
How I use VPN on Android
In the comany I work for we are providing VPN connection to our employees. To set up the VPN connection using pre shared key, I use following settings on my LG G3 phone.
Settings --> Networks --> Tethering &networks --> VPN --> Add VPN network VPN field: Name: Work Type: IPSec Xauth PSK Server: VPN IP. IPSec identifier: Connection profile IPSec pre-shared-key: Secret key.

Friday, 24 October 2014
Export MySQL data to CSV file
As much as importing data into MySQL is helpful, you also might like to export your data to CSV file format that is widely supported. You can open your data with spreadsheet like Excel, Libreoffice Calc, Google sheets and more. There are various techniques of how to export a MySQL table to a CSV file, but I'm going to demonstrate two methods.
Method 1: MySQL
Following SQL query will dump all the records from a table called "person" into the file /tmp/export_person.csv as a CSV file.SELECT * from person INTO OUTFILE '/tmp/export_person.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM test_table;
Take note of that the directory must be writable by the MySQL database server. Also that it will not overwrite the file if it already exists.
Method 2: Command line
You can also use command line in Linux to get your report. To get the same data as the example above$ mysql -u dbusername -pdbpassword exampledb -B -e "select * from \'person\';" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > export_person.csv
- mysql : the executable file (should be where MySQL is installed)
- -u dbusername : a switch and option for the username to execute the SQL with
- -p dbpassword : a switch and option for the password of the user
- exampledb : the database to run the SQL against
- -B : instructs that the output should be tab delimited (we will convert this to commas later in the command)
- -e “the sql statement here” : the SQL statement to run returning your data
- | sed ’s/\t/”,”/g;s/^/”/;s/$/”/;s/\n//g’ : sed is a Unix stream processor, essentially allow for transformations in this case. Here we have four sed commands that change the tabs to double quotes, adds double quotes to the beginning and end of each line and adds a new line marker at the end of each line.
- > export_person.csv : outputs the results to the file named export_person.csv
See also Import csv to MySQL
Subscribe to:
Posts
(
Atom
)









