This file contains hidden or 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 sys | |
counter = 0 | |
for line in open(sys.argv[1],'r'): | |
counter = counter + 1 | |
print counter, line, |
This file contains hidden or 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
tail -f file.log | grep --line-buffered "search pattern" | while read line | |
do | |
echo $line | |
done | |
# the line --line-buffered is key here, the read will fail without it |
This file contains hidden or 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
# tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=lcase,unblock | GREP_COLOR="1;32" grep --color "[^ ]" |
This file contains hidden or 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
ADMIN="[email protected]" | |
# set alert-level 90 % standard | |
ALERT=10 | |
df -h | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $6 }' | while read output; | |
do | |
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 ) | |
partition=$(echo $output | awk '{ print $2 }' ) | |
if [ $usep -ge $ALERT ]; then | |
echo "space low on \"$partition ($usep%)\", on server $(hostname) at $(date)" | | |
mail -s "Alert: Free space low, $usep % used on $partition" $ADMIN |
This file contains hidden or 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
class Hello { | |
void sayhello() { | |
System.out.println("Hello World\n"); | |
} | |
} | |
class HelloMain { | |
public static void main(String []args) { | |
System.out.println("Hello World\n"); | |
} |
This file contains hidden or 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
// Hello.h | |
#import <Foundation/Foundation.h> | |
@interface Hello: NSObject { | |
} | |
- (void) sayhello ; | |
@end |
This file contains hidden or 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
# Send an HTML email with an embedded image and a plain text message for | |
# email clients that don't want to display the HTML. | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEText import MIMEText | |
from email.MIMEImage import MIMEImage | |
import smtplib | |
# Define these once; use them twice! | |
strFrom = '[email protected]' # Who is this email coming from |
This file contains hidden or 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
#! /sw/bin/python | |
# filename: todosqlite.py | |
# author: ted heich | |
# blog: http://fornoobs.info | |
# | |
# A simple todo list app using Python and sqlite using the cmd line interface | |
# | |
#from pysqlite2 import dbapi2 as sqlite | |
import pysqlite2.dbapi2 as sqlite |
This file contains hidden or 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
#-*- coding: ISO-8859-1 -*- | |
# filename: todosqlite-createdb.py | |
# author: ted heich | |
# | |
# This program is the first part of the todosqlite app, this program handles | |
# the creation of the table. If todo.sqlite does not exist on the file system. | |
# Everytime you run this code, the table todo will be dropped and recreated--so be warned. | |
# it is created automatically. | |
# |
This file contains hidden or 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 | |
# Simple bash script to send Tweets using bash | |
# author: ted heich | |
# blog: http://www.kindawannadothat.com | |
user="type-your-twitter-username-here" | |
password="type-your-password-here" | |
echo "What are you doing right now? " | |
read message |
NewerOlder