Skip to content

Instantly share code, notes, and snippets.

@johng
johng / git alias
Created February 20, 2021 12:12
git alias
[alias]
co = checkout
# Add and remove all changes, note how this alias is calling another alias
addremove = !git r && git add . --all
# Show all of my configured aliases
aliases = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort
# For when you made that commit a bit too early, amend
@johng
johng / vaccine.sh
Last active January 17, 2021 18:52
Covid Vaccine Tracker UK
#!/usr/bin/env python3
# Note: Shamelessly copied from a now lost Reddit comment
from requests import get
import pandas as pd
from matplotlib import pyplot as plt
import datetime
API_ENDPOINT = 'https://api.coronavirus.data.gov.uk/v2/data?'
API_AREATYPE = "overview"
test
import math
def distinct(num):
a = set()
while num > 10:
end = num % 10
@johng
johng / com.googlecode.iterm2.plist
Last active March 6, 2020 11:49
Iterm Preferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AlternateMouseScroll</key>
<true/>
<key>AppleAntiAliasingThreshold</key>
<integer>1</integer>
<key>AppleScrollAnimationEnabled</key>
<integer>0</integer>
@johng
johng / .bash_alias
Last active February 3, 2018 13:20
Environment Configurations
alias bash_profile='vim ~/.bash_profile'
alias sshconfig='vim ~/.ssh/config'
alias ll='ls -FGlAhp'
alias ..='cd ../'
alias path='echo -e ${PATH//:/\\n}'
alias ~="cd ~"
alias cp='cp -iv'
alias mv='mv -iv'
alias mkdir='mkdir -pv'
@johng
johng / ether
Created August 12, 2017 22:42
Ether Test
0x5E0642bfeB8ab79cF160B4F07B88997827E3617c
@johng
johng / pg-pong.py
Created March 23, 2017 10:56 — forked from karpathy/pg-pong.py
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

Keybase proof

I hereby claim:

  • I am johng on github.
  • I am john_g (https://keybase.io/john_g) on keybase.
  • I have a public key ASC3Ariv5AEjomrckRqspl952F71QarcqClJmG-hiP-ktgo

To claim this, I am signing this object:

@johng
johng / com.googlecode.iterm2.plist
Created January 1, 2017 23:25
Iterm2 Preferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppleAntiAliasingThreshold</key>
<integer>1</integer>
<key>AppleScrollAnimationEnabled</key>
<integer>0</integer>
<key>AppleSmoothFixedFontsSizeThreshold</key>
<integer>1</integer>