Skip to content

Instantly share code, notes, and snippets.

View alok's full-sized avatar

Alok Singh alok

View GitHub Profile
@Gabriella439
Gabriella439 / package.dhall
Created April 7, 2018 02:45
The Cabal file format encoded as a Dhall type
let Version = ∀(Version : Type) → ∀(v : Text → Version) → Version
in let VersionRange =
∀(VersionRange : Type)
→ ∀(anyVersion : VersionRange)
→ ∀(noVersion : VersionRange)
→ ∀(thisVersion : Version → VersionRange)
→ ∀(notThisVersion : Version → VersionRange)
→ ∀(laterVersion : Version → VersionRange)
→ ∀(earlierVersion : Version → VersionRange)
@timvieira
timvieira / lagrangeprop.py
Last active May 1, 2022 06:54
Automatic differentiation as the method of Lagrange multipliers. Code accompanies this blog post: http://timvieira.github.io/blog/post/2017/08/18/backprop-is-not-just-the-chain-rule/
# -*- coding: utf-8 -*-
"""
Backprop as the method of Lagrange multiplers (and even the implicit function
theorem).
"""
from __future__ import division
import numpy as np
from arsenal.alphabet import Alphabet
from arsenal.math.checkgrad import finite_difference
FROM tensorflow/tensorflow:0.12.1
RUN mkdir /src
WORKDIR /src
RUN apt-get update
RUN apt-get install -y git wget
RUN git clone https://github.com/openai/gym
WORKDIR /src/gym
RUN pip install -e .
@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

The best:

@zchee
zchee / neovim_colorscheme_patcher.rb
Created December 27, 2015 00:50 — forked from metalelf0/neovim_colorscheme_patcher.rb
Neovim colorscheme patcher to add 24bit colors to terminal
#!/usr/bin/env ruby
class VimColorscheme
attr_accessor :file_path
def initialize(file_path)
@file_path = file_path
end
def extract_colors
diff --git a/colour.c b/colour.c
index a56ddce..8098f83 100644
--- a/colour.c
+++ b/colour.c
@@ -29,305 +29,85 @@
* of the 256 colour palette.
*/
-struct colour_rgb {
- u_char i;
@vitorprado
vitorprado / gist:97ab0bca23d9416d6006
Created March 2, 2015 17:59
zsh agnoster theme with since last commit time segment.
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://gist.github.com/1595572).
#
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

@choppsv1
choppsv1 / tmux-24.diff
Last active December 21, 2018 15:25
True color (24-bit) terminal support for tmux-1.9a and tmux-2.0
This diff is a modified version of a diff written by Arnis Lapsa.
[ The original can be found here: https://gist.github.com/ArnisL/6156593 ]
This diff adds support to tmux for 24-bit color CSI SRG sequences. This
allows terminal based programs that take advantage of it (e.g., vim or
emacs with https://gist.github.com/choppsv1/73d51cedd3e8ec72e1c1 patch)
to display 16 million colors while running in tmux.
The primary change I made was to support ":" as a delimeter as well