Skip to content

Instantly share code, notes, and snippets.

@oker1
oker1 / post-checkout
Last active December 21, 2015 01:49 — forked from lyrixx/post-checkout
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR="\x1B[0m"
find src -name '*.php' -print0 | xargs -0 -I{} gsed -i 's/\(.*\)?>/\1/' '{}'
@oker1
oker1 / RomanNumbersTest.scala
Created February 20, 2013 20:38
roman numerals kata
import org.scalatest._
class RomanNumbersTest extends FlatSpec with ShouldMatchers with BeforeAndAfterEach {
private var numbers: RomanNumbers = _
override def beforeEach() {
numbers = new RomanNumbers
}
"Roman numbers" should "convert I to 1" in {
@oker1
oker1 / json.scala
Last active December 11, 2015 09:48
sealed abstract class JValue {
override def toString: String = {
this match {
case JString(value) => String.format("\"%s\"", value)
case JBool(true) => "true"
case JBool(false) => "false"
case JNumber(value) => value.toString
case JNull() => "null"
case JList(values) => "[" ++ values.map(_.toString).mkString(", ") ++ "]"
case JObject(values) => "{" ++ values.foldLeft("") { case (prefix, (key, value)) => prefix ++ String.format("\"%s\": %s", key, value) } ++ "}"
@oker1
oker1 / README.md
Last active December 11, 2015 08:08

sbt gen-idea

@oker1
oker1 / rotate1.hs
Created November 4, 2012 15:03
haskell házi 1
rotate :: String -> [String]
rotate l = rotate_recursive l []
rotate_recursive :: String -> String -> [String]
rotate_recursive [] list = []
rotate_recursive list1 list2 =
let (h1:t1) = list1
in [list1 ++ list2] ++ rotate_recursive t1 (list2 ++ [h1])
-- http://code.google.com/codejam/contest/1460488/dashboard#s=p2
@oker1
oker1 / Readme.md
Created September 16, 2012 13:39
gmvault launchctl

launchctl load ~/Library/LaunchAgents/local.gmailbackup.plist

@oker1
oker1 / chef-roles-to-json-task.rb
Created December 18, 2011 18:41 — forked from timdiggins/chef-roles-to-json-task.rb
rake task to convert existing ruby roles to json
# ADD this to Rakefile and run it by issuing rake roles.to_json
ROLE_DIR = File.expand_path(File.join(TOPDIR, "roles"))
namespace :roles do
desc "Convert ruby roles from ruby to json, creating/overwriting json files."
task :to_json do
Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file|
role = Chef::Role.new
role.from_file(rb_file)
json_file = rb_file.sub(/\.rb$/,'.json')
@oker1
oker1 / Portfile
Created November 30, 2011 20:59
zlib Portfile without xcode
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$
PortSystem 1.0
name zlib
version 1.2.5
categories archivers
maintainers landonf ryandesign openmaintainer
license zlib
@oker1
oker1 / backup.sh
Created November 1, 2011 12:31
linux desktop backup
#!/bin/bash
set -e
#cryptsetup luksFormat -c aes-ecb-plain -s 128
#open, mount
cryptsetup luksOpen /dev/disk/by-uuid/e0f51d72-1331-4663-a4ac-281cacdbe691 backup
mount /media/backup