Skip to content

Instantly share code, notes, and snippets.

🐁
Clack clack click clack

Gergely Nagy algernon

🐁
Clack clack click clack
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}
View keybase.md

Keybase proof

I hereby claim:

  • I am algernon on github.
  • I am algernon (https://keybase.io/algernon) on keybase.
  • I have a public key whose fingerprint is 10E6 5DC0 45EA BEFC C519 3A26 AC1E 90BA C433 F68F

To claim this, I am signing this object:

View logic-of-sleep.hy
(import [adderall.dsl [*]]
[human])
(require adderall.dsl)
(defn awake-too-longᵒ [last-sleep-time]
(project [last-sleep-time]
(if (> (- (time) last-sleep-time) 14)
#ss
#uu)))
@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
You can’t perform that action at this time.