Skip to content

Instantly share code, notes, and snippets.

View jvkersch's full-sized avatar

Joris Vankerschaver jvkersch

View GitHub Profile
@jvkersch
jvkersch / update-emacs-ppa.sh
Created February 20, 2016 21:26 — forked from DamienCassou/update-emacs-ppa.sh
Emacs-snapshot and emacs24 build script for Ubuntu PPA
#! /usr/bin/env bash
# Author: Damien Cassou
#
# This is the script I use to build Emacs packages for Ubuntu. These
# packages are uploaded to
# https://launchpad.net/~cassou/+archive/emacs/. Each package is
# either build from a Debian package or from
# http://emacs.naquadah.org/.
""" Self-contained code example to listen for postgres events.
This is the Python 3 counterpart of
http://bjorngylling.com/2011-04-13/postgres-listen-notify-with-node-js.html
Preconditions: create a database and a trigger with
CREATE TABLE foo (id serial primary key, name varchar);
from numpy import empty
def mandelbrot_escape(x, y, n):
""" Mandelbrot set escape time algorithm in real and complex components
"""
z_x = x
z_y = y
for i in range(n):
z_x, z_y = z_x**2 - z_y**2 + x, 2*z_x*z_y + y
@jvkersch
jvkersch / little_schemer.el
Created September 20, 2016 12:07
The code from "The Little Schemer", translated to Emacs Lisp
;;; -*- lexical-binding: t -*-
(defun atom? (x) (not (listp x)))
(atom? 'abc)
(atom? 1)
(atom? '(a b c))
(defun member (a lat)
(cond ((null lat) nil)
# Mangled version of Chaco's lasso demo that has a LassoSelection that
# constrains the selection to be parallel to the coordinate axes.
import sys
# Major library imports
from numpy import sort, compress, arange
from numpy.random import random
import numpy as np
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8}
\usepackage[english]{babel}
\usepackage{hyperref}
\title{Korean Class \\
26 November 2016 \\
{\small \url{%
#!/usr/bin/env python
"""Horrible hacked-together script to reformat import statements along
something that vaguely resembles our coding standard. To be called from
within Emacs via
(defun jvk/python-reformat-import ()
(interactive)
(save-excursion
(let ((pmin (py-statement-point-begin))
(pmax (py-statement-point-end)))
# -*- coding: utf-8 -*-
from __future__ import division, print_function
from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'
from traits.api import HasTraits, Instance, String
from traitsui.api import Action, Controller, Handler, Item, View
import sys, traits, traitsui
print ('python version :',sys.version) # 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
@jvkersch
jvkersch / Titanic-MWE.ipynb
Last active November 28, 2017 09:26
Seaborn plot indeterminacy minimal working example (Titanic dataset)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jvkersch
jvkersch / scheme.py
Created December 12, 2017 18:11
scheme interpreter
#!/usr/bin/env python3
# TODO
# 2. support block structure
from collections import deque, namedtuple
import contextlib
from functools import reduce
import operator
import re