Skip to content

Instantly share code, notes, and snippets.

@tomgullo
tomgullo / GetSubnetIps.java
Created August 14, 2012 18:17
get ips from subnet
def s = new org.apache.commons.net.util.SubnetUtils(<cidr>)
println s.getInfo().getAllAddresses()
@tomgullo
tomgullo / view_traffice.sh
Created August 14, 2012 13:36
Use existing connection to run tcpdump
tcpdump -s0 host ? and port 22 and not port <get from /var/log/secure>
@tomgullo
tomgullo / get_backup.sh
Created August 9, 2012 17:48
get remote backup
#!/bin/sh
mon=$(date +%m)
day=$(date +%d)
file=username@ip:/home/username/${mon}${day}<year><hour><time>dump.tar.gz
scp $file .
@tomgullo
tomgullo / clean_up_html.sh
Created August 8, 2012 18:08
sed example
#!/bin/sh
filename='?'
sed -i -e 's/
//g' $filename && sed -i -e 's/ class=\"pt12\"//g' $filename && sed -i -e 's/ class=\"pt10\"//g' $filename && sed -i -e 's/\&Acirc;\&nbsp;//g' $filename && \
sed -i -e 's/<br>//g' $filename && sed -i -e 's/data-mce-//g' $filename && sed -i -e 's/ style="font-size: 10pt;"//g' $filename && sed -i -e 's/ style="font-size: 12pt;"//g' $filename && \
sed -i -e 's/ style="font-size: x-small;"//g' $filename
@tomgullo
tomgullo / get_clob.groovy
Created June 14, 2012 12:46
get a clob from Oracle
def sb = new StringBuffer()
def c = e.THE_CLOB
if ( (int) c.length() ) {
def buffer = new char[length]
def r = c.getCharacterStream()
def count = 0
while ( (count = r.read(buffer) ) != -1 ) { sb.append(buffer) }
}
println sb.toString()
ffmpeg -i file.mpeg file.webm
ffmpeg -i file.mpeg -vcodec libx264 -vpre libx264-hq -b 1500k file.mp4
<video width="320" height="240" controls="controls">
<source src="file.mp4" type="video/mp4"/>
<source src="file.webm" type="video/webm"/>
<p>Your browser does not support this video</p>
</video>
@tomgullo
tomgullo / deny_all_but_localhost.txt
Created May 24, 2012 16:29
only allow localhost to access server
Order deny,allow
deny from all
allow from 127.0.0.1
@tomgullo
tomgullo / gist:2782092
Created May 24, 2012 15:02
steps to fade image in gimp
1. Layers (Menu) -> Mask -> Add Layer Mask (White)
2. Make sure fg is black; bg is white
3. Click blend tool and then drag
@tomgullo
tomgullo / alias
Created May 23, 2012 12:56
create alias to show contents of latest modified file
alias latest='ls -lrth . | tail -1 | awk "{print \$9 }" | xargs cat | less +G'
@tomgullo
tomgullo / local_tunnel.sh
Created May 21, 2012 15:16
local tunnel
ssh remoteuser@remotehost -p 22 -o TCPKeepAlive=yes -L 9999:localhost:80