Booting Ubuntu from USB External Drive on Macbook Air
So I have that tiny USB 3.0 bootable 32GB drive , where I have copied (using dd) Ubuntu instalation from my workstation. It's very convenient to have it, as I can boot from it on any machine (even inside VirtualBox ), and instantly get my familiar working environment 1 .
Story is,that recently I've tried this trick with Macbook Air, and was very disappointed - despite as Ive holded
⌥
button firmly during boot, my awesome USB wasn't detected.
Thing is that my Ubuntu installation had BIOS boot mode , but Macbooks only support EFI boot.
If you Google that problem, you will find extremely complex solutions.
Here's much more simple one, which will not require any modifications in your Ubuntu installation, and it will still be bootable on computers without EFI support.
Read More →Simple Hackable Pomodoro Timer
There are tons Pomodoro timers out there. But they are either not customizable, or have "Enterprise Architecture" with multiple methods and calls in the source code, making it complicated to quickly make changes. What if want to quickly customize timer for yourself?
You may want to:
- Score Habitica habits on completed or canceled Pomodoros
- Set Slack to "do not disturb" mode while Pomodoro is running
- Set Tomato Emoji as Slack status, so your colleagues get that you are "trying to concentrate"
- Update Beeminder to match goal of completing n Pomodoros per day
- Change color to match your favorite breed of tomato
- ...
So I've created one more Pomodoro timer . Less than 50 lines of *very simple cross-platform 1 Python script. By default, it displays "always on top" window with a timer in window and title.
The code has no options, as its self-explanatory and intended to be hacked and modified to fit your specific vision of how Pomodoro timers should work. Read More →
Proper way to create alert box in Markdown
Sometimes, especially when writing documentation, you might want to put text in a nice colored box . To highlight info, notes, warnings, alerts etc. Like this:
The problem here is that there no such tag in markdown. So your only option is to use html or macros. As markdown is not processed inside html tags and following code:
<div class="note">
**NOTE**: Source [here](//developer.run)
</div>
Will look like this:
So you either need to make all text inside warning box html (which is ugly and inconsistent) or look for a better solution. Read More →
whereami
If you wake up from amnesia, and found yourself near computer, first thing you need to type is
whoami
. After that, you probaly want to type
history
to recall whats happened. Third logical question would be
whereami
, but unfortunatelly command does not exist by default. So prepare yourself to sudden amnesia now, and add to your aliases:
alias whereami='curl ifconfig.co/json'
It will show your ip and location. Also useful to check which VPN are you using.
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
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.
-
Git hub has built in redirect, i.e.
https://github.com/user/repo/releases/latest
which redirect to page dedicated to latest release -
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 ushttps://github.com/user/repo/releases/tag/0.15.9
-
Now we can extract version by using
basename
, i.e.basename https://github.com/user/repo/releases/tag/0.15.9
will return0.15.9
- 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.com 1 . 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
Awesome portable Sega
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 controllers 1 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.
- 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
ormd-2700
or just look for one with 2 cards/cartridges (old had only one card))
-
To buy new - search for
- 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 :)
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
+
fzf
1
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 .
© 20xx
Hosted on Cloudflare Pages, which is awesome!