Skip to content

Instantly share code, notes, and snippets.

@jhrr
jhrr / mysql-to-postgres.sh
Created February 6, 2024 14:19 — forked from dougvj/mysql-to-postgres.sh
Mysql to Postgres SQL file conversion
# Adapted from github comment:
# https://github.com/dimitri/pgloader/issues/782#issuecomment-1136067634
if [ -z "$3" ]; then
echo "Usage: $0 <db name> <mysql dump> <psql dump output>"
echo "Requirements: docker"
exit 1
fi
if ! command -v docker &> /dev/null
@jhrr
jhrr / OSX-fixes.el
Last active January 6, 2024 07:25
Make sure emacsen in a graphical frame running on OSX have the correct path and that the hash key (alt-3) is working.
;; Detect OS
(defvar macosx-p (string-match "darwin" (symbol-name system-type)))
;; osx fixes
(defun insert-hash ()
(interactive)
(insert "#"))
(defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell
@jhrr
jhrr / russell.agda
Created March 24, 2015 14:46
Russell's paradox in Agda
{-# OPTIONS --type-in-type #-}
{-
Computer Aided Formal Reasoning (G53CFR, G54CFR)
Thorsten Altenkirch
Lecture 20: Russell's paradox
In this lecture we show that it is inconsistent to have
Set:Set. Luckily, Agda is aware of this and indeed
Set=Set₀ : Set₁ : Set₂ : ...
@jhrr
jhrr / _HowToSetupAWSWAFv2.md
Created July 3, 2023 22:13 — forked from masayoshi644/_HowToSetupAWSWAFv2.md
How to setup AWS WAFv2
@jhrr
jhrr / Export MUBI lists.js
Created February 12, 2021 18:26
Export MUBI lists
$('#multi-films .film-grid').children().map(function() {
var $this = $(this),
rank = $this.find('.list-film-position').text().trim(),
title = $this.find('.film-title').text().trim(),
dirYear = $this.find('.director-year').text().trim(),
re = dirYear.match(/^(.+), (\d+)$/),
dir = re ? re[1] : dirYear,
year = re ? re[2] : '';
return [rank, title, year, dir].join('\t');
}).get().join('\n');
@jhrr
jhrr / bling.js
Last active January 31, 2023 20:04 — forked from paulirish/bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
}
NodeList.prototype.__proto__ = Array.prototype
@jhrr
jhrr / gol.py
Created June 5, 2014 10:51
Jack Diederich's implementation of Conway's "Game of Life"
import itertools
def neighbors(point):
x, y = point
yield x + 1, y
yield x - 1, y
yield x, y + 1
yield x, y - 1
yield x + 1, y + 1
yield x + 1, y - 1
@jhrr
jhrr / init.el
Created March 26, 2014 22:26
c311 .emacs settings -- including miniKanren stuffs
;;; .emacs (full version)
;;; A .emacs file for C311 students. To use this file, rename
;;; it to '.emacs' and place it in your home directory.
;;; [3 November 2004]
;;; Will Byrd created the initial version of this file from the
;;; simple .emacs file posted earlier. Portions of this file were
;;; were taken from Aziz Ghuloum's .emacs file.
@jhrr
jhrr / monads.txt
Created January 13, 2015 16:39
"Programming with Effects" by Graham Hutton -- http://www.cs.nott.ac.uk/~gmh/monads
PROGRAMMING WITH EFFECTS
Graham Hutton, January 2015
Shall we be pure or impure?
The functional programming community divides into two camps:
o "Pure" languages, such as Haskell, are based directly
upon the mathematical notion of a function as a
mapping from arguments to results.