Skip to content

Instantly share code, notes, and snippets.

View levent's full-sized avatar

Levent Ali levent

View GitHub Profile
@levent
levent / gist:2842257
Created May 31, 2012 09:35 — forked from seanlilmateus/gist:1448227
macruby video face detector
#!/usr/local/bin/macruby
framework 'QuartzCore'
framework 'AVFoundation'
class NSTimer
def self.scheduledTimerWithTimeInterval interval, repeats: repeat_flag, block: block
self.scheduledTimerWithTimeInterval interval,
target: self,
selector: 'executeBlockFromTimer:',
userInfo: block,
repeats: repeat_flag
@levent
levent / gist:2828934
Created May 29, 2012 15:05 — forked from seanlilmateus/gist:1461269
Macruby isight animated wall; press q to exit and any key to animate the wall
#!/usr/local/bin/macruby
framework 'QuartzCore'
framework 'AVFoundation'
class NSColor
def toCGColor
# approach #2
components = [redComponent, greenComponent, blueComponent, alphaComponent]
color_space = CGColorSpaceCreateWithName(KCGColorSpaceGenericRGB)
{"feed":"http://api.pachube.com/v2/feeds/504.json","creator":"http://www.pachube.com/users/hdr","tags":["hq","office"],"description":"Sensors in Pachube.com's headquarters.","datastreams":[{"max_value":"658.0","min_value":"0.0","at":"2011-06-13T12:05:09.317006Z","tags":["humidity"],"current_value":"16","id":"0"},{"max_value":"999.0","min_value":"0.0","at":"2011-06-13T12:05:09.317006Z","tags":["light level"],"current_value":"939","id":"1"},{"max_value":"774.0","min_value":"158.0","at":"2011-06-13T12:05:09.317006Z","tags":["temperature"],"current_value":"327","id":"2"},{"max_value":"0.0","min_value":"0.0","at":"2011-06-13T12:05:09.317006Z","tags":["door 1"],"current_value":"0","id":"3"},{"max_value":"0.0","min_value":"0.0","at":"2011-06-13T12:05:09.317006Z","tags":["door 2"],"current_value":"0","id":"4"},{"max_value":"40.0","min_value":"0.0","at":"2011-06-13T12:05:09.317006Z","tags":["failures"],"current_value":"0","id":"5"},{"max_value":"32767.0","min_value":"-32768.0","at":"2011-06-13T12:05:09.317006Z","tags
@levent
levent / juggernaut.rb
Created March 13, 2011 19:43
Publish changes to Redis
Juggernaut.publish("task_board_#{@task_board.id}", @task.as_json)
/*
Pachube sensor client
This sketch connects an analog sensor to Pachube (http://www.pachube.com)
using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
the Adafruit Ethernet shield, either one will work, as long as it's got
a Wiznet Ethernet module on board.
Circuit:
* Analog sensor attached to analog in 0
grep -v INFO app.log | less -S
array.inject(Hash.new(0)) { |hash, item|
hash[item] += 1
hash }.sort_by { |k, v| v }.reverse.map { |k, v| "#{k}:#{v}" }
@levent
levent / huntress
Created September 28, 2010 10:07
My responses to SPAM from Huntress recruitment consultants
Each time they replied with confirmation that my email had been removed
=================
=================
January 07
please unsubscribe my email address from all your lists
thanks and happy new year
@levent
levent / .vimrc
Created September 27, 2010 08:40
set nocompatible
syntax on
filetype plugin indent on
set number
set softtabstop=2
set tabstop=2
set shiftwidth=2
set expandtab
au BufNewFile,BufRead *.less set filetype=css
colorscheme vividchalk
@levent
levent / gist:595465
Created September 24, 2010 14:27 — forked from maccman/gist:595463
/*
Less CSS3 utils.
Usage:
.fooClass {
border: 3px solid #000;
.vbg-gradient(#FFF, #CCC);
.hbox();
}
*/