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 / check4change.sh
Created March 3, 2012 19:52
poor man's intrusion detection
#!/bin/sh
# poor man's intrusion detection.
#
# usage:
#
# (1) add website to git:
# ssh my-webserver
# cd web-root-folder
# git init
@thomd
thomd / .screenrc
Created March 27, 2012 11:15
screenrc
termcapinfo xterm* 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
startup_message off
# open a split screen for git and vim
split
screen -t vim 0
@thomd
thomd / hack.sh
Created April 2, 2012 08:41 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@thomd
thomd / Gemfile
Last active October 3, 2015 18:58
Sinatra Templates
source :rubygems
gem 'sinatra'
group :development do
gem 'sinatra-contrib', :require => 'sinatra/reloader'
gem 'foreman'
end
@thomd
thomd / descendants.rb
Created May 5, 2012 22:25
ruby descendants method
# ruby1.9
class Class
def descendants
ObjectSpace.each_object(::Class).select {|klass| klass < self }
end
end
# Ruby pre-1.8.7:
class Class
@thomd
thomd / sqlite-tutorial.sql
Created June 1, 2012 20:04
SQLite tutorial
-- This is an SQLite tutorial / cheat sheet by Kurt Schwehr, 2009
-- Conventions:
-- All SQL keyworks are written UPPERCASE, other stuff lowercase
-- All SQLite commands start with a "."
-- Two dashes start a comment in SQL
/* Another style of comments */
----------------------------------------
@thomd
thomd / Rakefile
Created September 14, 2012 13:31
Rake Helpers
desc "example usage of rake helper"
task :default do
Rake::Shell["ls -al"]
Rake::Log["usage of rake helper"]
end
module Rake
class Shell
def self.[](command)
output = %x[#{command}]
@thomd
thomd / xgoogle.rb
Created November 9, 2012 14:27
print URLs of google search results to stdout
#!/usr/bin/env ruby
#
# print URLs of google search results to stdout
# the name 'xgoogle' is a homage to Peteris Krumins' xgoogle
#
# dependencies:
# gem install nokogiri
#
# usage:
# xgoogle <searchquery> [<number-of-results> [<language>]]
@thomd
thomd / xml-post.html
Created December 19, 2012 16:03
a perfectly formatted Cross-Domain XML POST request. The ENCTYPE avoids the body being encoded
<form name="example" enctype="text/plain" action="http://example.com/xmlrpc/" method="post">
<input type="hidden" name='<?xml version'
value='"1.0"?><methodCall><methodName>stocks.buy</methodName><params><param><value><string>MSFT</string></value></param><param><value><double>26</double></value></param></params></methodCall>'>
</form>
<script>document.example.submit();</script>
// ==UserScript==
// @name jQuery
// @namespace http://www.joanpiedra.com/jquery/greasemonkey
// @description Play nicely with jQuery and Greasemonkey
// @author Joan Piedra
// @homepage http://www.joanpiedra.com/jquery/greasemonkey
// @include *
// ==/UserScript==
var $;