Skip to content

Instantly share code, notes, and snippets.

View cleemesser's full-sized avatar

Chris Lee-Messer cleemesser

  • Stanford University
View GitHub Profile
@cleemesser
cleemesser / simple-bootstrap.ipynb
Last active December 19, 2015 15:59
simple example of using bootstrapping to understand the variation caused by small samples
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cleemesser
cleemesser / min-char-rnn.py
Created October 7, 2015 18:31 — forked from karpathy/min-char-rnn.py
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)
@cleemesser
cleemesser / gruln.py
Created July 26, 2016 17:38 — forked from udibr/gruln.py
Keras GRU with Layer Normalization
from keras.layers import GRU, initializations, K
from collections import OrderedDict
class GRULN(GRU):
'''Gated Recurrent Unit with Layer Normalization
Current impelemtation only works with consume_less = 'gpu' which is already
set.
# Arguments
output_dim: dimension of the internal projections and the final output.
from bokeh.core.properties import String, Instance
from bokeh.models import LayoutDOM, Slider
CODE ="""
import {div, empty} from "core/dom"
import * as p from "core/properties"
import {LayoutDOM, LayoutDOMView} from "models/layouts/layout_dom"
export class CustomView extends LayoutDOMView {
@cleemesser
cleemesser / README
Last active January 19, 2019 20:37 — forked from denmerc/README
A simple script that helps setting up git for windows "portable zip file" version on a flash drive with PortableApps
-- Add Portable software to your msysgit-PATH --
If you like to work with your *nix shell even under Windows, you'll
likely use the git-bash provided by msysgit a lot.
A problem might be, that you don't have your tools in the PATH of that
shell and therefore can't use them. Those tools might be on the same
USB-drive as the git-shell, so you would have to adjust the PATH
(if you're allowed to) every time the drive-letter changes.
@cleemesser
cleemesser / rclone-copy-examples
Created April 7, 2019 18:45
rclone copy with basic filter on windows
To copy just a subset of files specify by a pattern. The following works from cmd.exe prompt on windows 10.
rclone copy --include <pattern> <src> <dest>
The quoting rules seem a bit complicated, especially for me on windows where I am less familiar with what cmd.exe does.
it did not work for me to specify pattern as \*.jpg. Instead I had to use double (not single) quotes:
example: just copy the *.jpg files inthe subdirectory images, where the current directory is C:\Users\cleemesser\
rclone copy --include "*.jpg" myremote:projects/images .\images
@cleemesser
cleemesser / crypt_unlock.sh
Created May 23, 2020 18:26 — forked from gusennan/crypt_unlock.sh
initramfs-hook for unlocking LUKS-encrypted LVM partition
#!/bin/sh
PREREQ="dropbear"
prereqs() {
echo "$PREREQ"
}
case "$1" in
prereqs)
@cleemesser
cleemesser / video-panel.py
Created September 18, 2020 21:36
show local mp4 video in panel (pyviz)
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.6.0
# kernelspec:
# display_name: Python 3
@cleemesser
cleemesser / weight_init.py
Created March 25, 2021 23:08 — forked from jeasinema/weight_init.py
A simple script for parameter initialization for PyTorch
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
import torch
import torch.nn as nn
import torch.nn.init as init
def weight_init(m):
'''
@cleemesser
cleemesser / pbr.py
Created May 6, 2021 00:46 — forked from GuillaumeFavelier/pbr.py
Physically Based Rendering (PBR) property for vtkPolyDataMapper
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vtk
def sphere(center, radius=1.0, color='Gray', metallic=0.5, roughness=1.0):
colors = vtk.vtkNamedColors()
cx, cy, cz = center