Skip to content

Instantly share code, notes, and snippets.

View pachacamac's full-sized avatar
🌶️
Mmmmhmmmm

Marc pachacamac

🌶️
Mmmmhmmmm
  • Hacker/Founder
  • Germany, Berlin
View GitHub Profile
@pachacamac
pachacamac / station_scanner.rb
Created May 31, 2012 16:30
station_scanner.rb
require 'time'
KNOWN_MACS = {
'**:**:**:**:**:**' => 'Marcs Handy'
}
def oui_lookup(mac)
owner = KNOWN_MACS[mac] || 'unknown'
oui = mac.upcase.tr(': ','-')[0..7]
vendor = `grep '^#{oui}' oui.txt | cut -f3`.strip
@pachacamac
pachacamac / googletts.rb
Created June 10, 2012 15:59
Google TTS
module GoogleTTS
require 'digest/md5'
require 'restclient'
TMP_PATH = '/tmp'
class << self
def say(text, lang='en')
file = download_audio(text, lang)
@gttspid = fork{ exec 'mpg123', '-q', file }
end
@pachacamac
pachacamac / talking_reddit.rb
Created June 10, 2012 19:08
Talking Reddit Watchdog
require 'restclient'
require 'json'
subreddits = {
'minimalism' => 'http://www.reddit.com/r/minimalism.json?sort=new',
'programming' => 'http://www.reddit.com/r/programming.json?sort=top&t=day',
'lifeprotips' => 'http://www.reddit.com/r/lifeprotips.json?sort=new',
'ruby' => 'http://www.reddit.com/r/ruby.json?sort=new',
'linux' => 'http://www.reddit.com/r/linux.json?sort=new',
'netsec' => 'http://www.reddit.com/r/netsec.json?sort=new',
#!/usr/bin/env ruby
a=[
' ',
' ......-+ ',
' . ...... ',
' ...+-... . ',
' .... ',
' . ..... ',
' .... ',
' -+...... . ',
@pachacamac
pachacamac / display-indicator.py
Created September 7, 2012 23:54 — forked from philayres/display-indicator.py
Unity indicator for simple clock and date display
#!/usr/bin/env python
# Unity indicator for evolution-less clock and date display
# author: phil ayres
# 24 Oct 2011
import gobject
import gtk
import appindicator
import os, sys
import time
@pachacamac
pachacamac / simple_battery_indicator.py
Created September 7, 2012 23:57
Simple Battery Indicator for Gnome, since Ubuntu 12.04 trolled me, I wrote my own ... fuck you ;)
#!/usr/bin/env python
import sys
import gtk
import appindicator
import re
import commands
PING_FREQUENCY = 30 # seconds
class CheckBattery:
@pachacamac
pachacamac / sublime_text_2_useful_shortcuts.md
Created September 19, 2012 15:16 — forked from nuxlli/sublime_text_2_useful_shortcuts.md
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@pachacamac
pachacamac / ruby_nuggets.rb
Created October 21, 2012 19:36
Some very nice tricks and helpful magic in Ruby
# $ grep '^###' ruby_nuggets.rb
# if you just want all headlines
### multiple heredoc goodness
head,body = <<END_HEAD,<<END_BODY
this is the head
yea still head
END_HEAD
and now some body
it is #{Time.now} now
@pachacamac
pachacamac / winspy.rb
Created October 21, 2012 20:27
Log what programs you're using
#!/usr/bin/env ruby
DATA.flock(File::LOCK_EX | File::LOCK_NB) or abort "Already running."
Process.daemon(true)
def active_window_info
Hash[`xprop -id $(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)" | awk '{print $5}')`
.scan(/^WM_(NAME|CLASS).*? = "(.*?)"(, "|$)/)
.map{|e| e.first.downcase!; e[0..-2]}]

tags: markdown cheatsheet help author: admin protected: admin

Markdown Cheatsheet

{:.no_toc}

  • toc {:toc}