Skip to content

Instantly share code, notes, and snippets.

View cleemesser's full-sized avatar

Chris Lee-Messer cleemesser

  • Stanford University
View GitHub Profile
@NightMachinery
NightMachinery / areplace.sh
Last active December 2, 2021 00:13 — forked from hlissner/replace.sh
Bulk search & replace with ag (the_silver_searcher)
# ag <https://github.com/ggreer/the_silver_searcher>
# from=str1 to=sth agr path1 path2 ...
# backs up to .pbak
comment() {
}
doc() {
}
function agr {
doc 'usage: from=sth to=another agr [ag-args]'
@cyberang3l
cyberang3l / How to setup VirtualGL and TurboVNC on Ubuntu.md
Last active March 23, 2024 05:52
Setup VirtualGL and TurboVNC on Ubuntu for OpenGL forwarding
@cvcore
cvcore / org-fragment-auto-preview.el
Last active May 30, 2020 18:33
Automatic fragment toggling in org-mode
;;
;; 28.07.2017
;; Charles Wang
;;
;;;;;;; Tweaks for Org & org-latex ;;;;;;
(defvar cw/org-last-fragment nil
"Holds the type and position of last valid fragment we were on. Format: (FRAGMENT_TYPE FRAGMENT_POINT_BEGIN)"
)
@whizzzkid
whizzzkid / XPS-15 9560 Getting Nvidia To Work on KDE Neon
Last active December 3, 2022 15:43
[XPS 15 Early 2017 9560 kabylake] Making Nvidia Drivers + (CUDA 8 / CUDA 9 / CUDA 9.1) + Bumblebee work together on linux ( Ubuntu / KDE Neon / Linux Mint / debian )
# Instructions for 4.14 and cuda 9.1
# If upgrading from 4.13 and cuda 9.0
$ sudo apt-get purge --auto-remove libcud*
$ sudo apt-get purge --auto-remove cuda*
$ sudo apt-get purge --auto-remove nvidia*
# also remove the container directory direcotory at /usr/local/cuda-9.0/
# Important libs required with 4.14.x with Cuda 9.X
$ sudo apt install libelf1 libelf-dev
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@snorfalorpagus
snorfalorpagus / sqlalchemy_nested_example.py
Created April 6, 2016 16:44
SQLAlchemy nested transactions
"""
This script demonstrates the use of nested transactions in SQLAlchemy, including
a workaround for an issue with the SQLite backend.
References:
http://docs.sqlalchemy.org/en/latest/orm/session_transaction.html#using-savepoint
http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#serializable-isolation-savepoints-transactional-ddl
"""
from sqlalchemy import Column, String, Integer
@karpathy
karpathy / min-char-rnn.py
Last active April 25, 2024 06:24
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)
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.