This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage[T1]{fontenc} | |
\usepackage{CJKutf8} | |
\usepackage[english]{babel} | |
\usepackage{hyperref} | |
\title{Korean Class \\ | |
26 November 2016 \\ | |
{\small \url{% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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/. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 | |
""" A script to check whether shows listed on SBS have Korean subtitles. | |
""" | |
import argparse | |
import logging | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Aggregate memory usage of a process and its children. | |
This utility measures the resident set size of a process and its children, and | |
returns the result either in bytes or formatted in a more convenient | |
format. Note: this "total resident size" is often an inflated measure of how | |
much memory a process group uses, as it will double-count e.g. memory used by | |
dynamic libraries and shared memory. It serves well as (a) a conservative | |
estimate, and (b) when sampled over time, to estimate changes in memory usage. | |
Requires psutil. |