Skip to content

Instantly share code, notes, and snippets.

View eigenhombre's full-sized avatar

John Jacobsen eigenhombre

View GitHub Profile
@danielpunkass
danielpunkass / gray.c
Created April 9, 2019 12:22
Standalone tool using private Apple framework to toggle display grayscale mode
#include <stdio.h>
// Compile with cc -o gray gray.c -framework UniversalAccess -F /System/Library/PrivateFrameworks
extern void UAGrayscaleSetEnabled(int isEnabled);
extern int UAGrayscaleIsEnabled();
int main() {
UAGrayscaleSetEnabled(!UAGrayscaleIsEnabled());
}
@bradtraversy
bradtraversy / vscode_shortcuts.md
Last active November 8, 2024 00:34
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@Medeah
Medeah / gist:2bc6e92b86ae7e8abc14
Last active December 15, 2016 22:21
Pending tests in clojure.test
;; This is free and unencumbered software released into the public domain.
;; Assume nothing works, and you may be pleasantly surprised; and when it breaks, you get to keep both pieces.
;; A Simple macro that enables you to change your testing groups to pending
(defmacro pending [name & body]
(let [message (str "\n" name " is pending !!")]
`(testing ~name (println ~message))))
@lbruder
lbruder / lbForth.c
Created April 6, 2014 15:21
A minimal Forth compiler in ANSI C
/*******************************************************************************
*
* A minimal Forth compiler in C
* By Leif Bruder <[email protected]> http://defineanswer42.wordpress.com
* Release 2014-04-04
*
* Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial
*
* PUBLIC DOMAIN
*
@arnaudsj
arnaudsj / lein-wtf.sh
Created March 19, 2014 02:24
When things seem to go south in your Clojure projects... (would have saved me hours today...)
#!/bin/bash
rm -Rf ~/.m2
rm -Rf ~/.lein
rm -Rf ./target
lein self-install
lein clean
lein version
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active September 12, 2024 16:16
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

@jackrusher
jackrusher / gist:5139396
Last active November 13, 2024 21:08
Hofstadter on Lisp: Atoms and Lists, re-printed in Metamagical Themas.

Hofstadter on Lisp

In the mid-80s, while reading through my roommate's collection of Scientific American back issues, I encountered this introduction to Lisp written by Douglas Hofstadter. I found it very charming at the time, and provide it here (somewhat illegally) for the edification of a new generation of Lispers.

In a testament to the timelessness of Lisp, you can still run all the examples below in emacs if you install these aliases:

(defalias 'plus #'+)
(defalias 'quotient #'/)
(defalias 'times #'*)
(defalias 'difference #'-)
@mrowe
mrowe / wait-for.clj
Last active July 20, 2020 18:09
A first attempt at a polling loop in clojure...
;; Based on a queue polling function from Chas Emerick's bandalore:
;; https://github.com/cemerick/bandalore/blob/master/src/main/clojure/cemerick/bandalore.clj#L124
(defn wait-for
"Invoke predicate every interval (default 10) seconds until it returns true,
or timeout (default 150) seconds have elapsed. E.g.:
(wait-for #(< (rand) 0.2) :interval 1 :timeout 10)
Returns nil if the timeout elapses before the predicate becomes true, otherwise