Skip to content

Instantly share code, notes, and snippets.

View thomd's full-sized avatar

Thomas Dürr thomd

  • Hamburg, Germany
View GitHub Profile
@thomd
thomd / userscript-updater.user.js
Created March 27, 2009 10:52
userscript updater snippet
// ==UserScript==
// @name easy userscript updater snippet
// @namespace http://thomd.net/userscript
// @description copy-paste this updater script snippet at the end of your userscript file hosted on userscripts.org. Your script is now displaying update notifications the next time you upload a new version of your script.
// @include http://domain-name.tld/*
// @author Thomas Duerr
// @version 1.0.1
// @date 2009-03-27
// ==/UserScript==
@thomd
thomd / httpdump
Created April 4, 2009 12:54 — forked from peterc/httpdump
httpdump
# Monitor HTTP requests being made from your machine with a one-liner..
# Replace "en1" below with your network interface's name (usually en0 or en1)
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile:
# (again replace "en1" with correct network interface name)
alias httpdump='sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"'
# All the above tested only on OS X.
@thomd
thomd / portscan
Created November 15, 2009 23:42
easy CLI portscan for OSX
sudo ln -s "/Applications/Utilities/Network Utility.app/Contents/Resources/stroke" /bin/portscan
portscan localhost 1 1000
@thomd
thomd / local POP3 on OSX
Created November 16, 2009 00:17
install a local POP3 server on OSX serving the system mailbox as a POP3 account.
#!/bin/sh
#
# install a local POP3 server on OSX serving the system mailbox as a POP3 account.
#
# get pre-compiled OS X binaries of UW's (University of Washington) ipop3d and imapd.
cd ~
curl -L -O http://www.macosxguru.net/downloads/localmail.zip
unzip localmail.zip
@thomd
thomd / javascript-animations.html
Created March 9, 2010 22:58
basic javascript-animations
<!DOCTYPE html>
<html>
<head>
<title>basic javascript-animations</title>
<style>
.boxes div{position:absolute;left:0px;width:100px;height:100px;background:#F00;}
#box1{top:100px;}
#box2{top:250px;}
#box3{top:400px;}
#box4{top:550px;}
var performance = (function () {
var my = {};
// Wrap a function body in this to return a copy that instruments itself
// If you want this to be useful, you should give your profiled function a name,
// otherwise it will be identified as "", which is less than useful.
my.profile = function (func) {
return function () {
var start = new Date().getTime(),
time,
<!DOCTYPE html>
<html>
<head>
<title>jQuery Templating Demo</title>
<style type="text/css">
html {
background:#f3f3f3;
font: 13px/1.5 helvetica, arial, san-serif;
}
ul {
/*!
* JavaScript preload() function
* Preload images, CSS and JavaScript files without executing them
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/
* Demo: http://mathiasbynens.be/demo/javascript-preload
*/
function preload(arr) {
var i = arr.length,
#!/bin/bash
PASTEL='{
"Ansi 0 Color" = {
"Blue Component" = 0.3097887;
"Green Component" = 0.3097887;
"Red Component" = 0.3097887;
};
"Ansi 1 Color" = {
"Blue Component" = 0.3764706;
@thomd
thomd / sierpinski-triangle.rb
Created October 19, 2010 21:14
Sierpinski triangle on Console in Ruby
ruby -le'64.times{|y|print" "*(63-y),(0..y).map{|x|~y&x>0?" ":" A"}}'