Sync Google calendar using Vdirsyncer and Orage08 Apr 2018 0 Comments
For a long time I wanted to have all my calendars and todo lists synchronized with my current desktop setup. Currently, I am using XFCE software, like Thunar, with Openbox to manage everyday stuff. Yes, I know with Gnome DE you can achieve that easily, but Gnome has a HUGE package dependencies. XFCE on the other hand is very light-weight and simple.
The other wonderful piece of software is vdirsyncer. It supports CalDAV protocol which is also supported by Google calendar. With simple configurations we can synchronize Google calendar locally. Then we can use Orage to view/modify our calendar files. Orage is a time-managing application that can manage your calendars, appointments, alarms, and todo lists.
First, make sure we have all the needed packages. Orage and Vdirsyncer should exist in most distros official repositories. In Archlinux, the installation can be done with
sudo pacman -S vdirsyncer orage. It would be similar for other distros as well. Ubuntu/Debian
sudo apt-get install vdirsyncer orage.
Here you can see how orage highlights dates with events attached to them. For example, April 1st is Easter Sundy. That was pulled from my Google United States holidays calendar.
First, we start by configuring Vdirsyncer to sync Google calendars. My configuration file looks like this:
Here, we specified were the status for Vdirsyncer should be located. Mine is located under ~/.vdirsyncer/status. Then we tell Vdirsyncer to create a pair of calendars for bidirectional syncing, where a is the actual Google calendar, and b is the local files pulled from the cloud. Then we define the two calendars as storages.
- storage local_calendar, here we specify what the type of this storage which is “singlefile” meaning Vdirsyncer would have a single file for each calendar that you have.
- storage google_calendar, here where it gets interested. The type here is “google_calendar” which means use Google cloud to fetch the calendars. With this type you have to specify a token file, client id, and client secret. All of these are essential for synchronizing.
Now we have to enable CalDAV API for our Google account.
- Go here and create a new project. This is required so that you can enable CalDAV API for that project.
- Click on “Enable APIs and Services” or on the left side click on Library, then search for “CalDAV” and enable it.
- Now we need to get our credentials, client secret and id, for the API. Click on “create credentials” then choose “CalDAV API” for your API and select “Other” for Application type. Click next and choose a name e.g. “vdirsyncer” then click continue.
- You will get your client id, stick it into your configuration file.
- We still missing the client secret. Click done after you get the client id then click on the credentials name and get the client secret from there.
Now we have Vdirsyncer config setup, we need to authorize it to access our Google account.
$ vdirsyncer discover calendar
This will try to authorize the pair ‘calendar’ defined in the config file. A browser window or a link should pop up to complete the authorization and that would create the access token defined in the config. Now we can synchronize Google calendar by
$ vdirsyncer sync
Read more about Vdirsyncer.
Now we need to tell Orage where are the calendar ics files so that we can view them in Orage. Run Orage then go to File -> Exchange data, and add all the pulled ics files from ~/.calendar. Notice the read only check mark, if you want to modify your Google calendar you have to make sure to uncheck that when you add your calendar file which is the same as your Google account name “[email protected]”. You should see all your calendars events highlighted within Orage. You can play with Orage settings to hide the window borders and tray icon. When double click on a date an events window should pop up then you can add events, todo, etc, but make sure you select your Google account file from the top bar in order to have it synchronized.
Using Cron to synchronize periodically
You can add a cron to automate the sync command.
MAILTO="" @hourly vdirsyncer sync
This will sync calendars every hour. Make sure you have a cron service running. I am using “cronie” for my setup and with Archlinux, I had to enable the cronie service for that to happen.
$ sudo systemctl enable cronie $ sudo systemctl start cronie
Dropbox client on Ubuntu server 16.0406 Aug 2017 0 Comments
Dropbox, in my opinion, is the best cloud service available. I wanted to have one shared dropbox folder that is accessible from all my virtual machines running on the server. I am using a ZFS drive as a storage drive, the dropbox folder is located in the ZFS drive. Dropbox service is running as a normal user, not the root, and the server is using systemd to start the service after booting the system.
First, you have to have the
libxxf86vm library, in Ubuntu 16.04 you can install it using
sudo apt install libxxf86vm1 then download Dropbox.
wget -O dropbox-x86_64.tar.gz https://www.dropbox.com/download?plat=lnx.x86_64
and if you are running a 32-bit system use:
wget -O dropbox-x86.tar.gz https://www.dropbox.com/download?plat=lnx.x86
Now choose where you want to put Dropbox binaries and extract the files, in my case I used
sudo mkdir -p /opt/dropbox sudo tar xzfv dropbox-x86_64.tar.gz --strip 1 -C /opt/dropbox
and because we are using a
/opt/dropbox we have to link it to
ln -s /opt/dropbox ~/.dropbox-dist
Run dropbox as a normal user
/opt/dropbox/dropboxd this will give you a link to login to your account or if you are running a GUI it will open your default browser with a link to authenticate your account. Ctrl-c to stop dropboxd.
As I said earlier, I want to put my Dropbox files on my storage drive. In my case I am using a ZFS drive located at
/pool/shared/ I moved the Dropbox folder from my home folder to
/pool/shared/Dropbox then linked the Dropbox folder to my home folder.
mv ~/Dropbox /pool/shared/Dropbox ln -s /pool/shared/Dropbox ~/Dropbox
Now if you want to control dropbox from the command-line you can use this tool
wget -O dropbox-cli.py https://www.dropbox.com/download?dl=packages/dropbox.py
You can move it to your PATH for easy access. You have to have
~/Dropbox to use this tool. You can start/stop and check the status of the Dropbox service. The
~/.dropbox folder is created after you start
For systemd to autostart Dropbox service simply create a new service at
/etc/systemd/system/[email protected] with these configurations:
[Unit] Description=Dropbox After=local-fs.target network.target [Service] Type=simple ExecStart=/opt/dropbox/dropboxd -p /home/%I/.dropbox/dropbox.pid ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure User=%I [Install] WantedBy=multi-user.target
This is basically a systemd service that can control Dropbox daemon from command-line. You can enable/start Dropbox from systemd
sudo systemctl start [email protected]$USER.service or if you want to enable it to start on boot
sudo systemctl enable [email protected]$USER.service
What is Jekyll?09 Jun 2017 0 Comments
Jekyll is a static website builder, it assembeles and combines multiple pages to form one unified HTML page. Jekyll uses YAML language to organize the structure of the page. Markdown language, which is a text-to-HTML converter, makes webpages easy to write and adapt.
Jekyll is writen in Ruby and can be installed using
gem. On a Linux machine that already has Ruby installed, Jekyll can be installed as the following:
Now you can visualize the page using http://localhost:4000