Skip to content

Instantly share code, notes, and snippets.

@mikezter
mikezter / application_controller.rb
Created September 10, 2010 09:01
Very simple logging of bot crawls in your Rails app. Drops to imedo.de
# drops to imedo.de
class ApplicationController < ActionController::Base
around_filter :log_crawlers, :unless => :logged_in?
def log_crawlers
action_start = Time.now
yield
duration = Time.now - action_start
Crawling.log(request, duration)
end
end
@mikezter
mikezter / HDCP MASTER KEY
Created September 15, 2010 00:21
HDCP MASTER KEY
HDCP MASTER KEY (MIRROR THIS TEXT!)
This is a forty times forty element matrix of fifty-six bit
hexadecimal numbers.
To generate a source key, take a forty-bit number that (in
binary) consists of twenty ones and twenty zeroes; this is
the source KSV. Add together those twenty rows of the matrix
that correspond to the ones in the KSV (with the lowest bit
in the KSV corresponding to the first row), taking all elements
@mikezter
mikezter / quine.rb
Created September 20, 2010 08:59
A ruby quine (stolen from somewhere i forgot)
def method;"def method;;end;puts method()[0, 11] + 34.chr + method + 34.chr + method()[11, method.length-11]";end;puts method()[0, 11] + 34.chr + method + 34.chr + method()[11, method.length-11]
@mikezter
mikezter / LG Support fail
Created October 11, 2010 11:10
kein LG support für mein GD510
Mobiltelefon-Support: mikezter. Willkommen beim LG Live Chat, wie können wir Ihnen helfen?
mikezter: Hallo! Der touchscreen meines telefons funktioniert nicht richtg.
mikezter: bei einer echten tastatur würde ich sagen "die taste ist eingeklemmt"
Mobiltelefon-Support: Wir gehen in diesem Fall von einem techn. Defekt aus.Es gibt fuer Sie zwei Moeglichkeiten. Entweder lassen wir das Telefon bei Ihnen zur Instandsetzung abholen oder Sie kontaktieren Ihren Haendler mit der Bitte um einen Geraetetausch bzw der Reparaturabwicklung.Im Falle einer Abholung bei Ihnen koennen wir einen Tag (Mo. - Fr.) terminieren, genauer jedoch nicht. Es muesste also ganztaegig jemand erreichbar sein.
mikezter: kann es ein softwareproblem sein?
mikezter: ist die abholung durch die garantie abgedeckt?
mikezter: und die reparatur?
mikezter: und wielange dauert das dann?
mikezter: zu meinem händler kann ich nicht, ich habe das gerät in mexico gekauft
Mobiltelefon-Support: In diesem Fall besteht in Deutschland leider kein Garantieanspruch
@mikezter
mikezter / on-top-button.diff
Created November 4, 2010 01:33
Always-on-top a button
diff --git a/ffx.htm b/ffx.htm
index 4a4ef7c..b802d8b 100755
--- a/ffx.htm
+++ b/ffx.htm
@@ -109,7 +109,7 @@
</script>
-<div id="noticias" style="position: absolute; left: 250px; top: 20px; float: inherit; width:125px;">
+<div id="noticias" style="z-index: 999999; position: absolute; left: 250px; top: 20px; float: inherit; width:125px;">
export VPS=YOUR.IP.ADDRESS.HERE
function initialize {
rm .ssh/known_hosts
server=${1:=${VPS}}
role=$2
: ${role:=rails}
ssh-copy-id -i ~/.ssh/id_rsa root@$server
ssh root@$1 "wget http://github.com/sid137/chef-repo/raw/master/install.sh -O install.sh && /bin/bash -x install.sh ${role}"
@mikezter
mikezter / chef-bootstrap.rb
Created November 9, 2010 12:09
chef-bootstrap.rb
#!/usr/bin/env ruby
def cmd(cmd)
puts cmd; system(cmd)
end
cmd "echo 'deb http://apt.opscode.com/ lenny main' | tee /etc/apt/sources.list.d/opscode.list"
cmd "wget -qO - http://apt.opscode.com/packages@opscode.com.gpg.key | apt-key add -"
cmd "aptitude -y update"
cmd "aptitude -y install git-core htop"
@mikezter
mikezter / sphinx-beta.rb
Created May 19, 2011 16:10
Homebrew Recipe to install Sphinx Search 1.10-beta
class SphinxBeta <Formula
url 'http://sphinxsearch.com/files/sphinx-1.10-beta.tar.gz'
homepage 'http://www.sphinxsearch.com'
md5 '5b52ce9e93a73c66d37bc3a2402f14fa'
head 'http://sphinxsearch.googlecode.com/svn/trunk/'
def install
fails_with_llvm "fails with: ld: rel32 out of range in _GetPrivateProfileString from /usr/lib/libodbc.a(SQLGetPrivateProfileString.o)"
config_args = ["--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"]
@mikezter
mikezter / mokloc.js
Created June 29, 2011 09:27
A bookmarklet to show your current IP's Geolocation
javascript:v=document;b=v.body;var m;if(!m){d=v.createElement('iframe');d.a=d.setAttribute;d.a('style','position:fixed;left:0;top:0;width:402px');d.a('src','//j.mp/meP7zk');b.appendChild(d);m=1}else{b.removeChild(d);m=0}
@mikezter
mikezter / gist:1231933
Created September 21, 2011 12:44
Frozenrails Notes

Some Frozenrails Notes

Jeff Casimir(@j3): The Problem is your Ruby

  • do not improve Rails skills, instead:
    • OO
    • Ruby
    • Design
    • ...