Skip to content

Instantly share code, notes, and snippets.

@lwhjp
lwhjp / factorial.rkt
Created October 19, 2014 08:18
Factorials in Racket
#lang racket
;;
;; These are some examples of different ways to compute factorials
;; using various paradigms and features provided by Racket. There
;; are more options available in packages which are not imported
;; by default, but that rabbit hole goes very deep indeed.
;;
;; Comments and suggestions welcome!
;; leo@lwh.jp
@fabrixxm
fabrixxm / gasyncspawn.py
Last active May 17, 2023 07:30
Run external process asynchronously with Python, GLib. Get stdout and stderr via signals.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#https://developer.gnome.org/pygobject/2.28/
#http://www.pygtk.org/articles/subclassing-gobject/sub-classing-gobject-in-python.htm#d0e570
from gi.repository import GObject
from gi.repository import GLib
class GAsyncSpawn(GObject.GObject):
@levand
levand / cider-opinions.md
Last active October 8, 2025 20:09
Why I don't use cider

Why I don't use cider.

This is all personal opinion and a matter of taste. I'm putting it here because people have asked - I'm glad Cider exists and that a lot of people are obviously using it to great effect. This is not an attack on Cider or a an attempt to negate the experience of those who like it, just my own experience.

Also some of the critiques are more properly aimed at nRepl than Cider - I don't use nRepl either, in Emacs. For some reason I have fewer issues with it in Cursive (though I still do have some).

  1. With Cider, there's too much "going on" between Emacs and Clojure. When something glitches, hangs, doesn't return a value, throws an excption, etc (as it does, multiple times a day), I don't know whether the problem is in Emacs, in the Cider client, the nRepl server, one of any of the default middlewares or in my actual program. I run Emacs in inferior lisp using lein trampoline -m clojure.main - if something goes wrong, it's either in Emacs (which is usually obvious) or my program. Mi
@john2x
john2x / 00_destructuring.md
Last active September 24, 2025 00:52
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@abayer
abayer / jenkins-git-backup.sh
Last active June 7, 2025 03:08
Example of a script for backing up Jenkins config in git.
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master
@azadkuh
azadkuh / OpenSSL cheat sheet for socket programmers.md
Last active September 16, 2025 08:11
OpenSSL cheat sheet. This is a brief howto for socket programmers.

#OpenSSL cheat sheet This is a brief howto for socket programmers.

create RSA key pairs

ex: 1024bits length key pair:

$> openssl genrsa -out myprivate.pem 1024
$> openssl rsa -in myprivate.pem -pubout -out mypublic.pem
@XVilka
XVilka / TrueColour.md
Last active October 9, 2025 17:55
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@x-or
x-or / xorgen2.py
Created July 20, 2013 11:30
Cellular Automata with Modular Arithmetic: Advanced Munching Squares
# Cellular Automata with Modular Arithmetic: Advanced Munching Squares
# Copyright (c) 2013, Sergey Shishmintzev
# License: MPL/GPL
# Interpreter: Python 2.7.3 + numpy 1.6.2 + PIL 1.1.7
#
# P.S. Sorry for my English. It isn't my mother tongue.
#
# Reference:
# [Khan1997] A.R. Khan, et.al., "VLSI architecture of a cellular automata machine", 1997,
# http://dx.doi.org/10.1016/S0898-1221(97)00021-7
@alanpog
alanpog / gist:3316784
Created August 10, 2012 18:55
Monad and Functor laws in Idris
module verified
---------- Functor ----------
-- Need this to avoid "Incomplete term" error
fmapid : Functor f => f a -> f a
fmapid = fmap id
class Functor f => VerifiedFunctor (f : Set -> Set) where
identity : (fa : f a) -> fmapid fa = fa
@vreon
vreon / .Xresources
Created February 27, 2011 03:26
molokai color theme for xterm
! Molokai theme
*xterm*background: #101010
*xterm*foreground: #d0d0d0
*xterm*cursorColor: #d0d0d0
*xterm*color0: #101010
*xterm*color1: #960050
*xterm*color2: #66aa11
*xterm*color3: #c47f2c
*xterm*color4: #30309b
*xterm*color5: #7e40a5