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/bash | |
# Tanky Woo@2012-12-13 | |
[ "$?" -ne "0" ] && { echo "FAIL"; exit 1; } || echo "SUCC" |
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
grep "str" file | |
if [[ $? -eq 0 ]];then | |
echo "error" | |
fi |
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/bash | |
dir=$1 | |
cd $dir | |
for ff in * | |
do | |
if [ -d "$ff" ]; then | |
du -hs "$ff"; | |
fi; | |
done |
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 threading | |
def worker(): | |
"""thread worker function""" | |
print 'Worker' | |
return | |
threads = [] | |
for i in range(5): | |
t = threading.Thread(target=worker) |
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 <stdio.h> | |
int main() | |
{ | |
printf("Hello World!"); | |
return 0; | |
} |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BOARD) | |
# need to set up every channel which are using as an input or an output | |
GPIO.setup(11, GPIO.OUT) | |
while True: |
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
# r_unit.py |
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/bash | |
# | |
### BEGIN INIT INFO | |
# Provides: iptables | |
# Required-Start: mountkernfs $local_fs | |
# Required-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Set up iptables rules | |
### END INIT INFO |
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
# Set up ssh-agent | |
SSH_ENV="$HOME/.ssh/environment" | |
function start_agent { | |
echo "Initializing new SSH agent..." | |
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}" | |
echo succeeded | |
chmod 600 "${SSH_ENV}" | |
. "${SSH_ENV}" > /dev/null | |
/usr/bin/ssh-add; |
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
RESET_COLOR = "\033[0m" | |
COLOR_CODES = { | |
"debug" : "\033[1;34m", # blue | |
"info" : "\033[1;32m", # green | |
"warning" : "\033[1;33m", # yellow | |
"error" : "\033[1;31m", # red | |
"critical" : "\033[1;41m", # background red | |
} |
OlderNewer