Skip to content

Instantly share code, notes, and snippets.

View narkisr's full-sized avatar
⌨️
bashing keybindings

Ronen narkisr

⌨️
bashing keybindings
View GitHub Profile
@narkisr
narkisr / zfs_notify_on_error.rb
Created December 30, 2011 00:18
zfs pool scrub and daily status email
#!/usr/bin/env ruby
require 'gmail'
def email_scrub_status(status)
gmail = Gmail.new('u', 'pass')
gmail.deliver do
to "dest@gmail.com"
subject "Zfs check result on Host"
@narkisr
narkisr / cron scruber
Created December 30, 2011 00:32
zfs scrubing
#!/usr/bin/env ruby
require 'gmail'
def email_scrub_run(status)
gmail = Gmail.new('foo', 'bar')
gmail.deliver do
to "dest@gmail.com"
subject "Your scheduled Zfs scrub was just performed "
@narkisr
narkisr / redis.clj
Created June 23, 2012 23:48
pallet redis crate
(ns pallet.crate.redis
"Simple redis crate for pallet,
with a DSL for configuration"
(:require [pallet.parameter :as parameter]
[pallet.action.package :as pkg]
[pallet.action.user :as user]
[pallet.action.directory :as dir]
[pallet.action.remote-file :as file]
[pallet.action.service :as service]))
@narkisr
narkisr / 8192cu-wifi
Created July 20, 2012 20:49
8192cu Wifi on your pie
See http://www.raspberrypi.org/phpBB3/viewtopic.php?t=6256 this desribes how to setup wifi for 8192cu based adapters,
Note that following http://elinux.org/RPi_edimax_EW-7811Un, looks like the above script does thing differently,
The /etc/network/interfaces:
iface wlan0 inet dhcp
wpa-ssid "ssid"
wpa-psk "password"
@narkisr
narkisr / gist:3162922
Created July 23, 2012 10:02
enabling ulimit memlock ubuntu 12.04
# /etc/security/limits.conf
ubuntu hard memlock 8388608
root hard memlock 8388608
# /etc/pam.d/common-session
session required pam_limits.so
Note this seems to be working altough ulimit -l still reports 64
@narkisr
narkisr / .ackrc
Created July 25, 2012 23:30
.ackrc
--type-set=clojure=.clj
--type-set=snippet=.snippet
--type-set=groovy=.groovy
--type-set=yml=.yml
--type-set=net=.cl
--type-set=json=.json
--type-set=jsp=.jsp
--type-set=jspf=.jspf
--type-set=ruby=.rb
--type-set=markdown=.md
@narkisr
narkisr / phpvirtualbox upstart
Created July 31, 2012 23:35
Loading phpvirtualbox and vms on boot using upstart
#/etc/init.d/vboxdrv, add to the end of the start function
/sbin/initctl emit vboxdrv-started
# this triggers two upstart jobs
# /etc/init/phpvirtualbox.conf
description "php virtualbox server"
@narkisr
narkisr / gemspec-fix.sh
Created August 10, 2012 23:49
Fixing invalid gemspec
# see http://biboyatienza.blogspot.co.il/2011/11/invalid-gemspec-in-varlibgems18specific.html
sudo sed -i 's/ 00:00:00.000000000Z//' /var/lib/gems/1.8/specifications/*
@narkisr
narkisr / incanter-webui.clj
Created August 15, 2012 13:59
Using Noir and incanter
(ns simple_server
(:gen-class)
(:use [noir.server :only (start load-views)])
)
(load-views "src/simple_web_app")
(defn -main [& m]
(let [port (Integer. (get (System/getenv) "PORT" "8080"))]
(start port {:mode :dev :ns 'stats-web})))
@narkisr
narkisr / dissoc-idx.clj
Created August 28, 2012 16:24
A index selection from a vector in Clojure
(defn index-exclude [r ex]
"Take all indices execpted ex"
(filter #(not (ex %)) (range r)))
(defn dissoc-idx [v & ds]
(map v (index-exclude (count v) (into #{} ds))))
(dissoc-idx [1 2 3] 1 2)
'(1)