Skip to content

Instantly share code, notes, and snippets.

endolith / Has weird right-to-left characters.txt
Last active Sep 24, 2021
Unicode kaomoji smileys emoticons emoji
View Has weird right-to-left characters.txt
karpathy /
Created May 30, 2016
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
jtadeulopes /
Last active Sep 5, 2021
Server setup with ubuntu, nginx and puma for rails app.

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone

ffmpeg -i -vcodec libx264 -vf 'scale=640:trunc(ow/a/2)*2' -acodec aac -vb 1024k -minrate 1024k -maxrate 1024k -bufsize 1024k -ar 44100 -strict experimental -r 30 out.mp4
erikh /
Created Mar 31, 2012 — forked from DAddYE/
OSX For Hackers
#!/usr/bin/env sh
# This is script with usefull tips taken from:
# install it:
# curl -sL | sh
zloedi / roguelike_FOV.c
Last active Aug 6, 2021
Efficient roguelike grid FOV / shadowcasting / line of sight in a single C function inspired by
View roguelike_FOV.c
// Copyright (c) 2021 Stoiko Todorov
// This work is licensed under the terms of the MIT license.
// For a copy, see
// What this function does:
// Rasterizes a single Field Of View octant on a grid, similar to the way
// field of view / line of sight / shadowcasting is implemented in some
// roguelikes.
// Uses rays to define visible volumes instead of tracing lines from origin
// to pixels.
kyleshevlin / memoizedHandlers.js
Created Jan 22, 2021
Using React.useMemo to create a `handlers` object
View memoizedHandlers.js
// One of my new favorite React Hook patternms is to create handler
// functions for a custom hook using `React.useMemo` instead of
// `React.useCallback`, like so:
function useBool(initialState = false) {
const [state, setState] = React.useState(initialState)
// Instead of individual React.useCallbacks gathered into an object
// Let's memoize the whole object. Then, we can destructure the
// methods we need in our consuming component.
// This is a proper alternative to
// The one in that file uses Promise, but that's *wrong*.
// We only used promise as a demo of its API. We'll remove it soon.
// As you can see below, the pure XMLHttpRequest code is just as clean,
// less mysterious for all, more performant, extensible, and actually correct.
// Ignore these externals for now. They're just for illustration
// purposes. I just copy pasted the Js code from
imjasonh / markdown.css
Last active Jun 10, 2021
Render Markdown as unrendered Markdown (see
View markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;