Skip to content

Instantly share code, notes, and snippets.

Ido Kanner ik5

  • :::1
Block or report user

Report or block ik5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ik5
ik5 / to_config.rb
Created Jan 31, 2014
Converting planet's html to planets.ini file
View to_config.rb
#!/usr/bin/env ruby
# encofing: utf-8
require 'rubygems'
require 'nokogiri'
page = Nokogiri::HTML(open('/tmp/planetfossil.htm'))
feeds = Hash.new
@ik5
ik5 / comparing_content.rb
Created Mar 16, 2014
Hetz request to compare two files with different lengths
View comparing_content.rb
#!/usr/bin/env ruby
output = open('output', 'w+')
lines = open('logfile').readlines
open('shortfile').each_line do |l|
name = l.chomp
output.puts name if lines.include? name
end
View adhearsion.god
# run with: rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god
# debug with: rvmsudo god quit && rvmsudo god -c /srv/phone/phonzy/current/ahn/config/god/adhearsion.god -D
@deploy_path = '/srv/phone/phonzy'
@shared_path = File.join @deploy_path, 'shared'
@app_path = File.join @deploy_path, 'current', 'ahn'
@log_path = File.join @shared_path, 'log'
@pid_path = File.join @shared_path, 'pids'
@pid_file = File.join @pid_path, 'adhearsion.pid'
@god_env = YAML.load_file("#{@shared_path}/config/god_environment.yml")
@ik5
ik5 / defer.go
Created May 28, 2014
defer in go
View defer.go
func open_file {
f, err := os.Open("/tmp/a_file")
if err != nil {
log.Fatal("Unable to open a_file")
}
defer f.Close()
// do something here
}
@ik5
ik5 / firebird.vim
Created Jun 13, 2014
Firebird SQL syntax for VIM - http://pastebin.com/DNag96VC
View firebird.vim
" Vim syntax file
" Language: SQL
" Maintainer: Scott Morgan < blumf7 at gmail dot com >
" Last Change: 2014-06-13
" Version: 1.0
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
@ik5
ik5 / redalarm.rb
Last active Aug 29, 2015
log alarms of rocket attacks on Israel using Ruby
View redalarm.rb
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
PKR_URL = 'http://www.oref.org.il/WarningMessages/alerts.json'
AREA_FMT = 'מרחב: %s, קוד מרחב: %s'
LOG_FMT = '[%s] id: %s, %s'
def to_json
@ik5
ik5 / ard_red.ino
Last active Aug 29, 2015
arduino based red color alarm for israeli missiles alert - a PoC video: http://youtu.be/AdF2AGIjtvY
View ard_red.ino
int led = 13;
int in = 0;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available() == 0) {
@ik5
ik5 / maildir.rb
Last active Aug 29, 2015
moving maildir from disorgenized method to an orginized method.
View maildir.rb
#!/usr/bin/env ruby
require 'fileutils'
SOURCE = '/tmp/mbox/'
DESTINATION = '/tmp/maildir/domain.com/'
def is_maildir(path)
dirs = Dir[File.join(path, '*')]
dirs.select {|name| File.directory?(File.join(path, name)) &&
@ik5
ik5 / Gemfile
Created Aug 21, 2014
Example for simple usage of Grape
View Gemfile
source "https://rubygems.org"
gem 'grape'
gem 'rack'
@ik5
ik5 / uuid-pg.sql
Created Sep 20, 2014
how to add the uuid-ossp extension
View uuid-pg.sql
/* install postgresql-contrib */
CREATE EXTENSION "uuid-ossp";
select uuid_generate_v4();
You can’t perform that action at this time.