Skip to content

Instantly share code, notes, and snippets.

View bcbnz's full-sized avatar

Blair Bonnett bcbnz

  • Hamburg, Germany
View GitHub Profile
diff -urN htop-1.0.3-orig/CRT.c htop-1.0.3/CRT.c
--- htop-1.0.3-orig/CRT.c 2014-11-04 14:10:29.500604247 +0100
+++ htop-1.0.3/CRT.c 2014-11-04 14:11:01.916663508 +0100
@@ -60,6 +60,9 @@
UPTIME,
BATTERY,
TASKS_RUNNING,
+ TEMPERATURE_COOL,
+ TEMPERATURE_MEDIUM,
+ TEMPERATURE_HOT,
@bcbnz
bcbnz / undo.sh
Created June 14, 2012 06:24
Removing change of a folder in Git
Upgraded a dependency in a Git repository to an incompatible version but due to insufficient testing didn't notice until several commits later. I *could* have just done a simple revert but was bored and figured out how to wipe it from history completely (usual disclaimer, rewriting history in a repository you have shared with anybody else is not a nice idea).
To fix it:
* Put a copy of the original folder (i.e., the one you actually want) in a separate location.
* Run the command in the script file below. This runs through each commit (so it could be very slow for a large repo), and checks if the new folder is present. If so, it deletes it and copies in the original. The tree-filter takes care of the Git add & rm commands as needed. The --prune-empty argument tells it to get rid of any empty commits (i.e., the one you committed the change in).
@bcbnz
bcbnz / termsize.py
Created November 28, 2011 10:00
Try to find the size of a terminal window.
import fcntl
import os
import struct
import sys
import termios
def window_size(fd):
"""Try to get the size of a terminal window.
:param fd: The file descriptor of the terminal window.