Skip to content

Instantly share code, notes, and snippets.

View levent's full-sized avatar

Levent Ali levent

View GitHub Profile
@levent
levent / es.sh
Last active December 24, 2015 09:49
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.11.deb
sudo dpkg -i elasticsearch-0.90.11.deb
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.1.deb
sudo dpkg -i elasticsearch-0.90.1.deb
#!/bin/bash
host=`facter fqdn`
if [[ ! -n "$1" ]]; then
port=8000
else
port=$1
fi
echo "http://$host:$port"
@levent
levent / test_http_clients.rb
Created August 31, 2012 08:39 — forked from jszmajda/test_http_clients.rb
a benchmark to test Net::HTTP, HTTParty, Curb, and system curl
require 'rubygems'
require 'httparty'
require 'curb'
require 'net/http'
require 'benchmark'
include Benchmark
RUNS = 1000
url = 'http://localhost:4567/'
@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)
@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();
}
*/
Name: Performance#description should replace an obscene description with an innocent one
Type: Failure Message:
expected: "Me performing care bear on my teddy",
got: "Me performing cunillingus on my teddy"
Name: Performance#title should replace an obscene title with an innocent one
Type: Failure Message:
expected: "care bear",
got: "fingerfuckers"
@levent
levent / gist:11439
Created September 18, 2008 15:21 — forked from lifo/gist:11172
# Released under WTFPL - http://sam.zoy.org/wtfpl/
module PoorMansMigrations
@@_migration_columns = []
def column(name, type, options = {})
@@_migration_columns << {:column_name => name, :column_type => type, :options => options}
end
def realize!(force_drop = false)
# Force drop if needed