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
#! /usr/bin/python | |
""" | |
Usage: | |
grep58.py <pattern> <file>... | |
grep58.py <pattern> | |
Examples: | |
# from file(s) |
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
#! /usr/bin/perl | |
# a Perl script with a "now" method to return a (yyyy_mm_dd_HH_mm_ss.ffffff) timestamp - Linux & Windows filename valid | |
use strict; | |
use warnings; | |
use POSIX; # for "strftime" | |
use Time::HiRes; # for "Time::HiRes::gettimeofday" | |
use 5.010; |
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
#! /usr/bin/perl | |
use strict; | |
use warnings; | |
use 5.010; | |
use Time::HiRes qw/time gettimeofday/; | |
use POSIX 'strftime'; | |
use FileHandle ('autoflush'); | |
use Getopt::Std; |
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
#! /usr/bin/python | |
""" | |
Usage: ./file.line.count.py <filename> | |
Example: ./file.line.count.py error.log | |
""" | |
import sys |
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
# a decent bash prompt | |
# \d = date - \t = time - \u = user - \h = host - \w = cwd | |
PS1='\[\e[1;32m\][\[\e[1;33m\]\d \[\e[1;34m\]\t \[\e[1;32m\]\u\[\e[1;36m\]@\[\e[1;31m\]\h\[\e[1;33m\](\[\e[1;36m\]\w\[\e[1;33m\])\[\e[1;32m\]]\[\e[1;37m\]% \e[m' | |
# disk usage | |
alias diskspace="du -Sh | sort -n -r |more" | |
# move up directories (i.e. "up" or "up 3") | |
up(){ |
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
#!/usr/bin/perl | |
# examples: | |
# ./runcmd.pl -l -c "ls -lah" | |
# include <timestamp> and enable <verbose> mode | |
# ./runcmd.pl -t -l -v -c "ls -lah" | |
# run multiple commands with <delay> = 5 |
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
#! /usr/bin/python | |
import sys | |
""" | |
usage: cat dogs_breakfast.py | ./chomp_stdin.py > dogsnuts.py | |
"chomp" noise from each line, half useful if you want to drop ALL formatting\identation | |
""" |
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
#!/usr/bin/perl | |
# "fetch" - a tiny grep\ACK util - more for education than practicality... | |
use strict; | |
use warnings; | |
use 5.010; | |
use File::Find; | |
use Cwd; | |
use Time::HiRes qw/ time /; |
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
#! /usr/bin/python | |
import logging | |
import ctypes | |
# output "logging" messages to DbgView via OutputDebugString (Windows only!) | |
OutputDebugString = ctypes.windll.kernel32.OutputDebugStringW | |
class DbgViewHandler(logging.Handler): | |
def emit(self, record): |
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
#! /usr/bin/python | |
import sys, os, time, difflib, optparse | |
BLUE = '\033[94m' | |
GREEN = '\033[92m' | |
YELLOW = '\033[93m' | |
RED = '\033[91m' | |
CYAN = '\033[96m' | |
WHITE = '\033[97m' |
OlderNewer