Run, Developer, Run!

Adding ToDos to Wunderlist via Fish Command line

(With human readable dates and autocompletion!)

Wunderlist is good GUI tool when you need todo organization, sharing and access from multiple devices. But for speed I want to add todos via command line, and allow scripts to do that for me.

If you Google "Wunderlist CLI", you will get solutions on Ruby and Nodejs. Nope, does not sound right for small CLI utility. Found good one written in Go - wl, but it intended as raw API, and there could be some user friendly improvements. For example you need to address lists via numeric id, and have to write date in defined format.

So I've created wrapper to make it more quick and convenient to use. Works like that (with tab completion and autosuggestions):

todo buy raspberry pi --life --on next monday
todo do code review --work --star
todo --work meet customer --on jan 7
todo visit mars --goals --on 2020-01-01
todo return books --on 3 days

Wrapper is written in Fish, because I wanted to try its syntax. Fish scripts are less bulky and more readable than Bash ones, but argument parsing is still a bother. So I've used lazy approach - check argument string for words using contains. Then remove all words starting with "--" by regexp. In my opinion result looks more clean.

I've also used lazy (but universal) approach to generate argument completion - search script source for strings starting with "--" and add them to Fish completion as arguments for todo command. Fish autosuggestions works greatly in this case - if you ever typed routine todo, fish will suggest completion next time.

Did you know that GNU Date understand human readable dates date --date="next Friday"? Cool! So script assumes everything after --on argument is date, so make sure it goes last in cmd. If date fails to interpret date it will save todo as todays with date in title, so you will be able to correclty set it manually later.

For installation read script header

Source on Github

How to download latest release from Github

Sometimes you might want to download latest release of binary from Github repo using script. You can do this using API, but lets assume that on some enviroments you have only basic tools, and no jq to extract values from JSon.

  1. Git hub has built in redirect, i.e. https://github.com/user/repo/releases/latest which redirect to page dedicated to latest release
  2. We can get redirect url with curl, i.e. curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/user/repo/releases/latest will get us https://github.com/user/repo/releases/tag/0.15.9
  3. Now we can extract version by using basename, i.e. basename https://github.com/user/repo/releases/tag/0.15.9 will return 0.15.9
  4. Using this version we can construct download url.

For example script that downloads and installs latest version of fzf

    #!/bin/bash
    export FZF_VERSION=$(curl -Ls -o /dev/null -w "%{url_effective}" https://github.com/junegunn/fzf-bin/releases/latest | xargs basename)
    curl -L https://github.com/junegunn/fzf-bin/releases/download/$FZF_VERSION/fzf-$FZF_VERSION-linux_amd64.tgz | tar -xz -C /tmp/
    sudo mv /tmp/fzf-$FZF_VERSION-linux_amd64 /usr/bin/fzf

Protected Text Backup

I really like service ProtectedText.com1. Its convenient way to store encrypted text and keep easy access to it, as notes are editable in browser, and can be opened from any device. Keep non-critical passwords there, or use it to share credentials.

Url is protected by https, encryption is done on client side (in your browser), and they keep code readable so you can review it yourself.

Only concern I have, that this nice service may be closed one day.

So I've created Script to backup ProtectedText

Features:

  • Can backup multiple secrets
  • If file is changed, keep previous version with date postfix
  • Only backups once per day
  • On success pings https://healthchecks.io/ so you'll be notified in case something goes wrong.

Files Can be decrypted using commandline:

base64 -d BACKUP_FILE | openssl aes-256-cbc -d -k PASSWORD

Source on Github

Awesome portable Sega

Portable Genesis

So along with playing Classic Console Games on my TV I occasionally want something portable to pass time on plane and hotel. Some guys are installing RetroArch to their Android phones and connecting controllers1 via Bluetooth, but I have alternative OS :/. Some are hacking PSPs, but its kindof bother to find good one cheap, then hack it. I'm also was looking at Dingoo A320 for a long time, but it's discounted now, and more expensive than PSP.

Suddenly I found awesome solution to play Genesis Games - little thingy called PXP 3.

UPD: I found a better toy

  • It costs 15€ for brand new and shipping on ebay! Still can't believe that they managed to implement stuff with screen so cheap.
  • Cool thing that its ready to play. So you don't need to experiment with incompatible emulators/roms just plug cartridge and play.
  • If you search for reviews, you may hear that screen is blinking and sound is awful. Its might be true for old versions but I have newer one, with ok screen, and surprisingly good sound.
    • To buy new - search for PXP3 slimstation 16bit 2016 or md-2700 or just look for one with 2 cards/cartridges (old had only one card))
  • It seems that this is not emulator, but real clone of Sega Nomad thats even more awesome. So no lags/incompatibilities.
  • I realy like that they made with cartridges:
    • Its random so you have that thrill of finding gems in pile of... em... stuff. Trust me there are ones. Mine had Sonic, Mortal Combat, Sokoban, Toy Story and Guntar Heroes. Surprisingly modern-made bootleg Angry Birds also included.
    • Games are completely random. 80 is built in than there 2 cartridges with around 30 games on each. Oh that good old 999999 in one trick.
    • If you persuade friend or colleague to also buy one, you can exchange cartridges like in good old times :)
Read More →

Fish Shell

Ok, so I've already have Intellij Idea that writes code for me translates my thoughts into code fast and without surplus typing. Now I have Fish Shell + fzf1 which does the same in console. Autocompletion rules! Life is short, you don't have time to (re)type everything manually.

And here is my config with lot of cool tricks.

Best templating language

If you use Jinja2, Django Templates or god forbid Mako it will slowly drag you into horrible practice to use logic inside your templates. It starts with adding complex conditions, regexes and string operations then gets you to point when html and buisiness code are "fused in unholy union" aka PHP.

To avoid it, use Mustache. It gives you only simple loops even more simple conditions. If you don't need even that - just use string.Template.

How to manage archives in Linux properly

  • All GUI archive managers in Linux suck1. Command line is much better, but when using GUI file manager I want to have basic actions (create/extract/mount archive & install package) available in right click menu.
  • You don't need GUI tool to browse archives. Much better solution is to mount it, so you can browse archive in file manager of your choice and open in associated applications without extraction.
  • While archive is extracted I want see terminal that shows progress. After extraction terminal is closed. If there's error during extraction I want to terminal left open to see error message (extract-command || true)

Tested with PCManFm in Lubuntu 16.04 with .7z .rar .zip .tar.gz .iso... etc.

Source on Github

Simple Calendar in Linux

Sometimes you will find yourself in Linux, and desire to see very simple calendar. No integrations, no synchronization, just simple table with day numbers. Sadly some DE does not show calendar by clicking on clock (for example if you fancy DockbarX). So what do you do?

You can type cal -3 in terminal and it will show you next and previous month. But way if you want little UI to navigate back and forward in months using buttons? Just type zenity --calendar.

Also check NiCl!

Xiaomi Mi Band 1S fair review

Xiaomi released affordable fitness band, got excellent reviews from major news sites because of its features, then removed these features by update (like Smart Alarm, Vibration on call). Although features are still advertised. Reason of this is still unknown - either they want to push customers to next version, or just want save resources on development and support.

Notification Tip

So some of services allow you to get email or push notifications. Thing is that probably you already receiving like a ton notifications per minute, and it really easy to miss important one.

There kind of was email from smoke detector that house if on fire, but it got lost somewhere between Twitter alerts and Instagram likes.

So for really-really important you can configure:

  • email → call in Itfff.com (if you fortunate to live in US)
  • email → Twilio.com in Zapier.com (if you even more fortunate to live in other place). Twilio.com will allow you to call yourself for free. Zapier.com will allow to make 100 email → call transactions in month. Should be enough (its more "routine" than "important" if theres more than 100)

Don't forget to put loud and distinctive ringtone to notification number, and allow it to pass "Do Not Disturb" mode.

←Prev 1 2 3 4 5 6 7 8 Next→

Contact

Follow

Me on Twitter, Mastodon and Github

We have RSS!

© 20xx

Hosted on Cloudflare Pages, which is awesome!