Skip to content

Instantly share code, notes, and snippets.

View Technologicat's full-sized avatar

Juha Jeronen Technologicat

View GitHub Profile
@yelouafi
yelouafi / multishot-callcc.js
Created September 21, 2018 17:05
multi shot continuations
function isGenerator(x) {
return x != null && typeof x.next === "function"
}
function isFrame(x) {
return x != null && x._type_ === 'call_frame'
}
function call(genFunc, ...args) {
@ericclemmons
ericclemmons / example.md
Last active April 24, 2024 18:09
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@rjpower
rjpower / setup-cuda.sh
Last active January 4, 2023 08:14
Install CUDA kernel module and system libraries for Ubuntu
echo 'deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64 /' > /etc/apt/sources.list.d/cuda.list
echo 'deb http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64 /' > /etc/apt/sources.list.d/nvidia-ml.list
apt-get update
apt-get install --force-yes -y nvidia-352
apt-get install --force-yes -y cuda-7-5 cuda-command-line-tools-7-5 cuda-core-7-5 cuda-cublas-7-5 cuda-cublas-dev-7-5 cuda-cudart-7-5 cuda-cudart-dev-7-5 cuda-cufft-7-5 cuda-cufft-dev-7-5 cuda-curand-7-5 cuda-curand-dev-7-5 cuda-cusolver-7-5 cuda-cusolver-dev-7-5 cuda-cusparse-7-5 cuda-cusparse-dev-7-5 cuda-documentation-7-5 cuda-driver-dev-7-5 cuda-gdb-src-7-5 cuda-ld-conf-7-5 cuda-license-7-5 cuda-minimal-build-7-5 cuda-misc-headers-7-5 cuda-npp-7-5 cuda-npp-dev-7-5 cuda-nvrtc-7-5 cuda-nvrtc-dev-7-5 cuda-runtime-7-5 cuda-samples-7-5 cuda-toolkit-7-5 cuda-visual-tools-7-5
apt-get install -y build-essential python-dev python-virtualenv python-pip
apt-get install -y libatlas-dev liblapack-dev
ap
@nazavode
nazavode / ctype_async_raise.py
Last active August 9, 2023 15:48 — forked from liuw/ctype_async_raise.py
Nasty hack to raise exception for other threads
from __future__ import print_function
import ctypes
import threading
import time
def async_raise(thread_obj, exception):
""" Raises an exception inside an arbitrary active :class:`~threading.Thread`.
Parameters
@marcora
marcora / gist:cb37b2432c072e8e9d77
Created September 15, 2015 03:24
Install Adobe Source Code Pro font on Linux
#!/bin/sh
echo "installing fonts at $PWD to ~/.fonts/"
mkdir -p ~/.fonts/adobe-fonts/source-code-pro
git clone https://github.com/adobe-fonts/source-code-pro.git ~/.fonts/adobe-fonts/source-code-pro
# find ~/.fonts/ -iname '*.ttf' -exec echo \{\} \;
fc-cache -f -v ~/.fonts/adobe-fonts/source-code-pro
echo "finished installing"
@karpathy
karpathy / min-char-rnn.py
Last active May 10, 2024 18:13
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@ynd
ynd / equi.py
Last active November 17, 2022 09:41
import numpy
import theano
from theano import tensor as T
from theano.sandbox import rng_mrg
class EquiSGD(object):
"""Equilibrated SGD (eSGD).
Parameters
@Gnonthgol
Gnonthgol / transfer.py
Last active April 8, 2020 11:52
Transfer angles for every circular orbit
#! /usr/bin/python
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <Gnonthgol@gmail.com> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return Gnonthgol
# ----------------------------------------------------------------------------
#
@thomasballinger
thomasballinger / subprocess.py
Created December 15, 2013 23:26
Using a pseudo-terminal to interact with interactive Python in a subprocess
from subprocess import Popen, PIPE
import pty
import os
from select import select
import sys
import tty
master, slave = pty.openpty()
p = Popen(['python'], stdin=slave, stdout=PIPE, stderr=PIPE)
pin = os.fdopen(master, 'w')
@liuw
liuw / ctype_async_raise.py
Created April 17, 2012 16:02
Nasty hack to raise exception for other threads
#!/usr/bin/env python
# liuw
# Nasty hack to raise exception for other threads
import ctypes # Calm down, this has become standard library since 2.5
import threading
import time
NULL = 0