Skip to content

Instantly share code, notes, and snippets.

💭
computers were a mistake

Winny winny-

  • USA
View GitHub Profile
View .xbindkeys.scm
(define (path-join . args) (string-join args "/"))
(define HOME (getenv "HOME"))
;;(define raise-volume "amixer -c 0 sset 'Master',0 2dB+")
;;(define lower-volume "amixer -c 0 sset 'Master',0 2dB-")
;;(define mute "amixer set Master toggle")
(define raise-volume "ponymix increase 5")
(define lower-volume "ponymix decrease 5")
(define mute "ponymix toggle")
;; Quick and easy intel backlight adjustment. Does not call
View init.el
(defun winny/raise-or-create-window-system-frame (display)
"Raise an existing frame in the window system or create a new one."
(let ((frames (seq-filter #'(lambda (f) (frame-parameter f 'display)) (frame-list))))
(if (null frames)
(make-frame `((window-system . x)
(display . ,display)))
(select-frame-set-input-focus (car frames)))))
View badurls.txt
js/options.js: searchenginary[0] = "http://www.readability.com/m?url=";
js/options.js: searchenginary[1] = "http://mobilizer.instapaper.com/m?u=";
js/options.js: searchenginary[2] = "http://s.evernote.com/grclip?url=";
js/options.js: searchenginary[3] = "http://wayback.archive.org/web/*/"
js/options.js: searchenginary[4] = "http://webcache.googleusercontent.com/search?q=cache:"
js/options.js: searchenginary[13] = 'http://webcache.googleusercontent.com/search?q=cache:';
js/options.js: searchenginary[20] = "http://www.tumblr.com/tagged/";
js/options.js: searchenginary[21] = "http://www.pinterest.com/search/pins/?q=";
js/options.js: searchenginary[22] = "http://www.reddit.com/search?q=";
js/options.js: searchenginary[23] = "http://digg.com/search?q=";
View init.el
(defun winny/raise-or-create-window-system-frame (display)
"Raise an existing frame in the window system or create a new one."
(let ((frames (seq-filter #'(lambda (f) (frame-parameter f 'display)) (frame-list))))
(if (null frames)
(make-frame `((window-system . x)
(display . ,display)))
(select-frame-set-input-focus (car frames)))))
View 99-problems.ml
(* Mine *)
let encode list =
let rec encode' current acc list =
match (current, list) with
| (None, []) -> acc
| (Some c, []) -> c::acc
| (None, h::t) -> encode' (Some (1, h)) acc t
| (Some ((count, elem) as c), h::t) -> if elem = h
then encode' (Some (count+1, elem)) acc t
else encode' (Some (1, h)) (c::acc) t
View 0-output.txt
1
120
==== but the following will fail ====
fact: contract violation
expected: natural?
given: -5
in: the 1st argument of
(-> natural? natural?)
contract from: (function fact)
blaming: /tmp/ex.rkt
View using-sml-and-scala.org

Using SML and Scala

Using SML

Installation

Use SMLNJ.

Getting line editing on Linux & Mac OS X

Install the rlwrap from your package manager. Prepend rlwrap to your invocation of sml like so: rlwrap sml.

Linux

Install package smlnj, and run sml from the shell.

View fizzbuzz.rkt
#lang racket
(require srfi/41)
(define (fizzbuzz-stream)
(let loop ([n 1])
(stream-cons
(match* ((modulo n 3) (modulo n 5))
[(0 0) "FizzBuzz"]
[(0 _) "Fizz"]
View data.json
[
{
"model": "webapp.game",
"pk": 3,
"fields": {
"name": "Shorewood businesses",
"active": false,
"winner": null,
View libpoker.c
unsigned char score(struct card *cards) {
if (cards[0].value == cards[1].value
&& cards[0].value == cards[2].value
&& cards[0].value == cards[3].value) {
return RANK_FOUR;
}
unsigned char order[] = {0, 1, 2, 3};
unsigned char swapped;
do {
You can’t perform that action at this time.