Skip to content

Instantly share code, notes, and snippets.

# For all files in urls.txt, check if the url loads correctly, and print it and the error message if # not
cat urls.txt | ruby -nle 'require "open-uri"; begin; open($_) {} rescue print $_ + " : " + $!; end'
@timmow
timmow / Find windows line endings
Created May 22, 2009 15:07
Find Windows Line endings
ggrep -lIUr "^M" --exclude='.svn'
@timmow
timmow / print filename from list of files if it doesn't exist
Created June 22, 2009 10:37
print filename from list of files if it doesn't exist
perl -nle 'print if !-e $_'
@timmow
timmow / gist:968567
Created May 12, 2011 14:10
Find 404s in an access log and order by most occurences
cat access.log | perl -lane 'print $F[9] . " " . $F[7]' | grep 404 | sort | uniq -c | sort -b -g
@timmow
timmow / gist:981903
Created May 19, 2011 22:07
regex to find url in css file
url\(['"]?[^)]*['"]?\)
User-agent: *
Disallow: /redirect/*
Sitemap: http://www.teennowmagazine.co.uk/sitemaps/index.xml
@timmow
timmow / gist:1118156
Created August 1, 2011 13:53
Extract SSL certificate and output information
# Extract SSL certificate and output information
openssl s_client -connect secure.yui.ipcdigital.co.uk:443 > logfile
# Type QUIT then enter
# Edit logfile and remove all except lines between BEGIN certificate and end certificate
openssl x509 -inform PEM -in logfile -text -out certdata
cat certdata
@timmow
timmow / gist:1183295
Created August 31, 2011 10:57
Flashing in oh-my-zsh
echo '%7B%22F'
@timmow
timmow / setup-statsd.sh
Created November 13, 2011 23:43 — forked from jasonroelofs/setup-statsd.sh
Turn an Ubuntu 11.10 EC2 into a StatsD/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils
sudo apt-get install git-core
sudo apt-get install nodejs
# install the Node package manager for later use
curl http://npmjs.org/install.sh | sudo sh
sudo npm install express
# clone the statsd project
git clone https://github.com/etsy/statsd.git
# download everything for graphite
@timmow
timmow / gist:1439003
Created December 6, 2011 17:14
Private messaging widget
<!DOCTYPE html>
<html xmlns:pas="http://phpinfo.tmower.connect-dev-web-01.bfb1.sites.ipcdigital.co.uk/pluckTest.html" xml:lang="en" lang="en">
<head>
<title>Client Flow Example</title>
<script type="text/javascript" src="http://goodtoknow.pluck.ipcdigital.co.uk/ver1.0/Content/ua/scripts/pluckApps.js"></script>
<script>
window.fbAsyncInit = function() {
FB.init({