Skip to content

Instantly share code, notes, and snippets.

View ochronus's full-sized avatar

Csaba Okrona ochronus

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ochronus on github.
  • I am ochronus (https://keybase.io/ochronus) on keybase.
  • I have a public key whose fingerprint is F2A9 DCD6 43E2 4C35 B14E A1AF 3C60 0433 84A5 7852

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am ochronus on github.
  • I am ochronus (https://keybase.io/ochronus) on keybase.
  • I have a public key whose fingerprint is F2A9 DCD6 43E2 4C35 B14E A1AF 3C60 0433 84A5 7852

To claim this, I am signing this object:

(ns noir01.views.welcome
(:require [noir01.views.common :as common]
[noir.content.getting-started])
(:use [noir.core :only [defpage]]))
(defpage "/welcome" []
(common/layout
[:p "Welcome to noir01"]))
#/bin/sh
MD5_TOOL=md5 # on linux set this to 'md5sum'
IFACE=en0 # probably eth0, etc on linux
RANDOM_MAC_ADDRESS=$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null|${MD5_TOOL}|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4:\5:\6/')
sudo ifconfig ${IFACE} ether ${RANDOM_MAC_ADDRESS}
if [[ $? != 0 ]] ; then
echo "Error changing the MAC address of ${IFACE}"
exit 1
else
echo "The interface ${IFACE} has the MAC address: ${RANDOM_MAC_ADDRESS}"
# ----------------------------
# pgPool-II configuration file
# ----------------------------
#
# This file consists of lines of the form:
#
# name = value
#
# Whitespace may be used. Comments are introduced with "#" anywhere on a line.
# The complete list of parameter names and allowed values can be found in the
@ochronus
ochronus / js_native_check
Created August 18, 2014 06:56
Check if a JS function is native
function isNative(fn) {
return (/\{\s*\[native code\]\s*\}/).test('' + fn);
}
@ochronus
ochronus / gist:bfbfb4d32572d7f3b086
Last active August 29, 2015 14:06
Brainfuck in Clojure
(defn bf-interpreter [program-code]
(let [
find-bracket (fn [opening-bracket closing-bracket instruction-pointer direction]
(loop [i (direction instruction-pointer) opened 0]
(condp = (nth program-code i)
opening-bracket (recur (direction i) (inc opened))
closing-bracket (if (zero? opened) i (recur (direction i) (dec opened)))
(recur (direction i) opened))))]
(loop [cells [0N], current-cell 0, instruction-pointer 0]
@ochronus
ochronus / gmail_deflooder.py
Last active September 4, 2015 20:41
Delete messages from flooded labels
import imaplib
EMAIL_ADDRESS = 'dummy@nowhere.net'
PASSWORD = 'nope nope nope'
FOLDER = 'This_is_a_parent_label/this_is_a_sublabel'
while True:
try:
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login(EMAIL_ADDRESS, PASSWORD)
@ochronus
ochronus / Pogácsa.txt
Created September 20, 2015 05:20
Pogácsa recipe
Ingredients for the dough:
500g flour (type: BL55)
250g butter
2 pieces of egg yolk (only the yolk!)
175g sour cream (20% fatty type is better but 12% is ok)
1 pack of dried yeast
some milk (100 ml or something)
2 teaspoons of salt
@ochronus
ochronus / process-ring.rb
Created November 25, 2011 11:20
Simple process ring using ruby continuations
require "continuation" # ruby 1.9, 1.8 doesn't need this require
class Ring
def initalize
@next_node = nil
end
attr_accessor :next_node
def create_continuation
passesleft, message = callcc { |cont|
return cont