Skip to content

Instantly share code, notes, and snippets.

View alok's full-sized avatar

Alok Singh alok

View GitHub Profile
@Goles
Goles / zsh_git_timer.sh
Created March 7, 2012 04:06
ZSH Snippets to add time since last commit, got this somewhere... forgot where :)
# Add this to your .oh-my-zsh theme if you're using those, or directly to your zsh theme :)
# Colors vary depending on time lapsed.
ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
#Customized git status, oh-my-zsh currently does not allow render dirty status before branch
git_custom_status() {
@incompl
incompl / gist:3819571
Last active March 19, 2023 16:05
Git needs help

The git command-line interface sucks

When I use git, I'm scared I'll break something. I just talked to an open source celebrity who has used git for 3-4 years who avoids using the CLI because he's afraid he'll break something, and uses Tower when possible. I recently had a client accidentally delete their work because they didn't understand git. My fear of breaking something is well-founded.

You can't put a price on the confidence that source control is supposed to give you. That confidence suffers when people are afraid of causing irreparable damage during normal use.

This article lists a few ideas on what git can do to improve.

A Controlled Vocabulary

@wellle
wellle / append.vim
Last active March 17, 2023 13:02
Commands to append after (and insert before) any text object. http://redd.it/1z93ww
nnoremap <silent> <Leader>a :set opfunc=Append<CR>g@
nnoremap <silent> <Leader>i :set opfunc=Insert<CR>g@
function! Append(type, ...)
call feedkeys("`]a", 'n')
endfunction
function! Insert(type, ...)
call feedkeys("`[i", 'n')
endfunction
@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
@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.

@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).
#
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;
@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

The best:

@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