Skip to content

Instantly share code, notes, and snippets.

🐁
Clack clack click clack

Gergely Nagy algernon

🐁
Clack clack click clack
Block or report user

Report or block algernon

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
@algernon
algernon / Sketch.ino
Created Feb 24, 2019
Kaleidoscope Sticky key plugin
View Sketch.ino
#include "StickyKey.h"
kaleidoscope::plugin::StickyKey StickyW(Key_W), StickyX(Key_X);
KALEIDOSCOPE_INIT_PLUGINS(StickyW, StickyX);
@algernon
algernon / git-send-github-pr.sh
Created Oct 7, 2018
git + hub command to send a PR w/ auto-created branch
View git-send-github-pr.sh
#! /bin/sh
## Place me on the PATH, as `git-send-github-pr`, and then `git send-github-pr HEAD^1`.
## The script will create a new branch, send the PR, then go back to wherever you were.
##
## (C) 2018 Gergely Nagy, released under the MIT license.
LAST_PR_ID="$(git branch --list 'github-pr/*' | cut -d/ -f2- | sort -n | tail -n 1)"
N="$(expr ${LAST_PR_ID} + 1)"
hub checkout -b "github-pr/${N}" ${1}
@algernon
algernon / Makefile
Created Jul 7, 2011
JSON to BSON conversion in C
View Makefile
all: json2bson
clean:
rm -f json2bson
json2bson: json2bson.c
${CC} $(shell pkg-config --cflags json libmongo-client glib-2.0) -Wall -O0 -ggdb3 -std=c99 ${CFLAGS} \
$(shell pkg-config --libs json libmongo-client glib-2.0) -o $@ $^
check: all
./json2bson <test.json >test.bson
@algernon
algernon / fizzbuzzbeep.hy
Last active Dec 16, 2015
FizzBuzzBeep in hy.
View fizzbuzzbeep.hy
#! bin/hy
(def targets {3 "fizz" 5 "buzz" 7 "beep"})
(defn match [n factors]
(filter (lambda [x] (= 0 (% n x))) factors))
(defn fizzbuzz [n]
(let [[factors (.keys targets)]
[matches (match n factors)]]
@algernon
algernon / fizzbuzz.hy
Last active Dec 15, 2015
FizzBuzz in Hy
View fizzbuzz.hy
#! bin/hy
; -*- mode: lisp; mode: paredit -*-
(import fizzbuzz-macros)
(defn fizzbuzz [n]
(let [[result ""]]
(if (zero? (% n 3))
(setv result (+ result "fizz")))
(if (zero? (% n 5))
@algernon
algernon / fizzbuzz-logic.clj
Last active Dec 12, 2015
My feeble attempt at implementing FizzBuzz using core.logic, one which can be run back and forth aswell. Requires core.logic 0.8.0-rc3-SNAPSHOT or later.
View fizzbuzz-logic.clj
(refer 'clojure.core :exclude [==])
(use '[clojure.core.logic])
(require '[clojure.core.logic.fd :as fd])
(require '[clojure.test :as t])
(defn multo
"Ensure that `n` is a multiplicate of `div`."
[n div]
(fresh [x]
@algernon
algernon / fizzbuzz-seq.clj
Created Feb 10, 2013
A fizzbuzz implementation that produces a lazy list of results.
View fizzbuzz-seq.clj
(defn fizzbuzz-seq
[]
(letfn [(nil-prefix [n s]
(concat (take n (cycle [nil])) [s]))]
(map #(let [s (or %4 %2 %3 (inc %1))] s)
(range)
(cycle (nil-prefix 2 "Fizz"))
(cycle (nil-prefix 4 "Buzz"))
(cycle (nil-prefix 14 "FizzBuzz")))))
@algernon
algernon / python-lisp-hybrid
Created Feb 4, 2013
A python "dialect" with significant parens. The point is, any whitespace at the beginning of line that is used for indentation must be replaced by opening parens, and to end a block, you must close all relevant parens.
View python-lisp-hybrid
def foobar(blah):
((for i in range(1, 10):
((((print "blah: %s" % blah))))))
@algernon
algernon / dance.bas
Created Nov 25, 2012
My very first program, ever
View dance.bas
10 PRINT CHR$(27);"N"
20 PRINT "\o/"
30 PRINT " | "
40 PRINT "/ \"
50 FOR I=1 TO 1000: NEXT
60 PRINT CHR$(27);"N"
70 PRINT " o "
80 PRINT "/|\"
90 PRINT "/ \"
100 FOR I=1 TO 1000: NEXT
@algernon
algernon / amqp-consumer.py
Created Oct 9, 2012
AMQP consumer in python, for testing
View amqp-consumer.py
#! /usr/bin/python
import sys
import pika
# Import all adapters for easier experimentation
from pika.adapters import *
pika.log.setup(pika.log.INFO, color=True)
You can’t perform that action at this time.