Posts about Code

Test markdown

Friday, 20 February 2015 at 00:00

Here’s a code chunk with syntax highlighting:

var foo = function(x) {
  return(x + 5);
$ echo $EDITOR
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ git push
Everything up-to-date
$ echo 'All
> done!'

You can write regular markdown here and Jekyll will automatically convert it to a nice webpage. I strongly encourage you to take 5 minutes to learn how to write in markdown - it’ll teach you how to transform regular text into bold/italics/headings/tables/etc.

Here is some bold text

Here is a secondary heading

Here’s a useless table:

Number Next number Previous number
Five Six Four
Ten Eleven Nine
Seven Eight Six
Two Three One

How about a yummy crepe?


Keep your ubuntu-gnome from waking up at random

Sunday, 18 September 2016 at 14:34   // reading time ~2 minutes

I have tried using /proc/acpi/wakeup and I’ve tried looking in /sys/bus/usb/devices/SOMETHING/power/wakeup for devices that will wake up the computer, however I finally fixed my random wakeup problems with a tool called acpitool.

It is really quite simple. First you need to install it, unless you already have it installed:

$ sudo apt-get install acpitool

Once it’s installed you can list what you can do with it, and to make it works.

$ acpitool --help

Then you can list all your devices (small w)

$ acpitool -w
   Device    S-state      Status   Sysfs node
  1. SBAZ      S4    *disabled  pci:0000:00:14.2
  2. PS2K      S3    *disabled
  3. PS2M      S3    *disabled
  4. UAR1      S4    *disabled  pnp:00:06
  5. P0PC      S4    *disabled  pci:0000:00:14.4
  6. UHC1      S4    *enabled   pci:0000:00:12.0
  7. UHC2      S4    *enabled   pci:0000:00:12.2
  8. UHC4      S4    *enabled   pci:0000:00:13.2
  23. PE21      S4    *disabled
  24. PE22      S4    *disabled
  25. PE23      S4    *disabled
  26. USB3      S4    *enabled   pci:0000:00:13.0
  27. USB5      S4    *enabled   pci:0000:00:16.0
  28. PWRB      S4    *enabled   platform:PNP0C0C:00

Then it’s just a matter of disable all the devices you don’t want to wake up the computer (large W).

$ sudo acpitool -W 6

Don’t disable everything, then you can’t wake the computer again :)

I keep the power button enabled. And have configured the computer to hibernate when it’s pressed, giving me a nice symmetry.

A better git log

Wednesday, 22 February 2017 at 08:38

I’ve just changed my git log command from the standard:


to the more compact and colorful:


It’s simple to get this log. Just type in:

$ git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

I guess that’s a bit too long, eh? Let’s just make an alias. Copy and paste the line below on your terminal:

$ git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

And every time you need to see your log, just type in

$ git lg

Everything here is shamelessly copied from this article:

 #git  #code or (all)