This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Turn off all jellybeans background colors (.vimrc) | |
" -------------------------------------------------- | |
" where turning off background colors would leave the text invisible | |
" on a dark background I've used the background color picked by jellybeans | |
" for the the foreground. | |
" | |
" NOTE: | |
" Setting the background of StatusLine and StatusLineNC to none | |
" seems to result in a bug in which the space of the status line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
g++ -std=c++0x -lboost_unit_test_framework ./parseFilename.cpp -oparseFilename && ./parseFilename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
/* returns: non-zero if s points to a sequence | |
* of characters that is palindromic, 0 if not | |
*/ | |
int is_palindrome (char *s) { | |
int N, n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sumsuffix | |
func SumSuffix (s string) int { | |
var r int | |
for i := 0; i < len(s); i++ { | |
suffix := s[i:] | |
for j := 0; j < len(suffix); j++ { | |
if s[j] != suffix[j] { | |
break | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd?", RUN+="/usr/local/bin/autoclone.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# the redirections are a bit confusing, but trust me it works | |
# progress_gpio.sh (change at your discretion) should read integers representing | |
# percentage progress and manipulate the leds accordingly | |
dd if="/dev/sda" | pv -EEn 2>&1 > out.img | progress_gpio.sh | |
# out.img should be a raw dump of the disk, but i'd recommend also | |
# saving an fdisk -l "/dev/sda". You could also compress the image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while getopts "ab-:" opt | |
do | |
case "${opt}" in | |
-) | |
case "${OPTARG}" in | |
foo) echo foo;; | |
bar) echo bar;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# f [targets]... | |
# process targets, reads targets from stdin if no arguments are supplied | |
f() { | |
if [ $# = 0 ] | |
then | |
while read -r t | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
struct list { | |
int v; | |
struct list *next; | |
}; | |
void reverse (struct list **head) { | |
struct list *p, *n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import subprocess | |
#device_re = "Bus \d{,3} Device \d{,3}: ID ([a-f0-9]+:[a-f0-9]+)" | |
device_re = "ID ([a-f0-9]+:[a-f0-9]+)" | |
df = subprocess.check_output("lsusb", shell=True) | |
for i in df.split('\n'): | |
if i: | |
print (re.findall(device_re, i, re.I)) |