Skip to content

Instantly share code, notes, and snippets.

@ncimino
ncimino / gist:3885267
Created October 13, 2012 16:34
jQuery create drop-downs and auto-filter
$(function() {
$("input[type=button][value=Add]").click(function(e) {
for (i = 0; i < document.getElementById('sel').value; i++) {
e.preventDefault();
var j = 1;
var newDiv = $("<div>").appendTo("#dropbox");
$("<select>").attr("name", "input1_"+j).appendTo(newDiv).append(
$("<option>").val("0").text("Option 1"), $("<option>").val("1").text("Option 2"));
$("<select>").attr("name", "input2_"+j).appendTo(newDiv).append(
$("<option>").val("0").text("Option 1"), $("<option>").val("1").text("Option 2"));
@ncimino
ncimino / untar_all.sh
Created October 10, 2012 18:46
Untar all
MYDIR="/home/${USER}/archives"
ls ${MYDIR}/*.tar > filelist
for FILENAME in `cat filelist`
do
ARCHDIR=${MYDIR}/$(basename $FILENAME .tar)
mkdir $ARCHDIR
echo ==== Extracting $FILENAME to $ARCHDIR:
tar -xf $FILENAME -C $MYDIR
done
@ncimino
ncimino / server.tcl
Created September 25, 2012 22:04
Server Side - Tcl
#!/usr/bin/tclsh
set svcPort 8001
proc doService {sock msg} {
puts $sock "$msg"
}
proc svcHandler {sock} {
set l [gets $sock]
@ncimino
ncimino / client.tcl
Created September 25, 2012 22:02
Client Side - Tcl
#!/usr/bin/tclsh
proc read_sock {sock} {
set l [gets $sock]
puts stdout "ServerReply:$l"
}
proc read_stdin {wsock} {
global eventLoop
set l [gets stdin]
@ncimino
ncimino / .bashrc
Created September 25, 2012 16:02
My .bashrc configuration
# .bashrc
# Remember to:
# cd ~
# wget https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh -O .git-prompt.sh
# wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -O .git-completion.sh
alias rm='rm -i'
alias cp='cp -i'
@ncimino
ncimino / ls30.sh
Created September 24, 2012 23:01
List Files Older than 30 days
#!/bin/sh
# Expects /path/to/dir_name
find ${1} -ls -mtime +30 -maxdepth 1
@ncimino
ncimino / whichmount.sh
Created September 24, 2012 23:00
Check which machine a directory is mounted to
#!/bin/sh
# Expects /path/to/dir_name
df ${1}
@ncimino
ncimino / subdirsize.sh
Created September 24, 2012 22:58
Check Sub-directory Size
#!/bin/sh
# Expects /path/to/dir_name
du -sh ${1}/*
@ncimino
ncimino / dirsize.sh
Created September 24, 2012 22:56
Check Directory Size
#!/bin/sh
# Expects /path/to/dir_name
du -sh ${1}
@ncimino
ncimino / getos.sh
Created September 24, 2012 22:54
Get Linux Distribution Information / OS Version
#!/bin/sh
cat /etc/*release