Skip to content

Instantly share code, notes, and snippets.

@Mic92
Mic92 / 0001-add-ac-plugin.patch
Created March 28, 2012 16:26
vicious.contrib.ac
From d917bb927d7a57ff3644dcc61de25b491d4f182e Mon Sep 17 00:00:00 2001
From: jinleileiking <jinleileiking@gmail.com>
Date: Thu, 29 Mar 2012 20:36:22 +0200
Subject: [PATCH] add ac plugin
---
contrib/README | 8 ++++++++
contrib/ac.lua | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
create mode 100644 contrib/ac.lua
@Mic92
Mic92 / decrypt.hs
Created April 14, 2012 20:27
Algebra - 8. Hausaufgabe
import Data.Char
alphabet = ['A'..'Z']++['ß','Ä','Ö','Ü']
charToInteger :: Char -> Integer
charToInteger char = maybe 0 id isValue
where charMap = zip alphabet [0..29]
isValue = lookup (toUpper char) charMap
integerToChar :: Integer -> Char
@Mic92
Mic92 / test.hs
Created April 15, 2012 19:48
haskell modulo
main = print $ (27^7) `mod` 30 == 3 -- True
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
From bd419aaee1c3488a8ebfc51093975d978305af6d Mon Sep 17 00:00:00 2001
From: jinleileiking <jinleileiking@gmail.com>
Date: Wed, 16 May 2012 18:37:15 +0200
Subject: [PATCH] cpufreq: handle not existing frequency/governer
In some cases not all cpu informations will be provided.
(ex. in virtual machines)
Therefore default to "N/A".
---
widgets/cpufreq.lua | 13 ++++++++++---
From e5630c1c1ab083af6dc0a956a35c2e0e609c87bc Mon Sep 17 00:00:00 2001
From: jinleileiking <jinleileiking@gmail.com>
Date: Wed, 30 May 2012 17:16:13 +0200
Subject: [PATCH] add wpa widget
---
contrib/README | 6 +++++
contrib/wpa.lua | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 Dateien geändert, 73 Zeilen hinzugefügt(+)
create mode 100644 contrib/wpa.lua
@Mic92
Mic92 / update-dnsdynamic.sh
Created September 4, 2012 12:00
Update Public Ip on dnsdynamic.com
#!/bin/sh
# EDIT this
EMAIL=youremail@example.com
PASSWORD=yoursecret
DOMAIN=example.dnsd.me
IP=`curl --silent http://myip.dnsdynamic.com/`
curl --silent --user "$EMAIL:$PASSWORD" -k "https://www.dnsdynamic.org/api/?hostname=$DOMAIN&myip=$IP"
@Mic92
Mic92 / deploy.rb
Created September 5, 2012 20:15
My mina deploy setup
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv'
# Basic settings:
# domain - The hostname to SSH to
# deploy_to - Path to deploy into
# repository - Git repo to clone from (needed by mina/git)
# user - Username in the server to SSH to (optional)
@Mic92
Mic92 / snippet.rb
Created September 27, 2012 08:25
Check if facebook user has uploaded a profile picture or uses the default in ruby
require 'net/http'
# idea: default profile photos has the Content-Type image/gif
# read this: http://stackoverflow.com/questions/5555199
def default_facebook_photo?(facebook_uid)
resp = fetch("https://graph.facebook.com/#{facebook_uid}/picture")
resp['content-type'] == 'image/gif'
end
# http head request which follows redirects
def fetch(uri, limit = 10)
@Mic92
Mic92 / default.rb
Created October 7, 2012 14:17
Update virtualbox additions in vagrant after upgrading linux kernel using chef
bash "update virtual box additions" do
# http://vagrantup.com/v1/docs/troubleshooting.html
code <<-EOS
/etc/init.d/vboxadd setup
EOS
# FIXME only works as long the kernel version doesn't change!
#not_if do
# # check if vboxsf driver is loaded
# `lsmod` =~ /vboxsf/
#end