Skip to content

Instantly share code, notes, and snippets.

@hyperupcall
hyperupcall / settings.jsonc
Last active June 26, 2025 09:47
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
#!/usr/bin/env bash
# use /usr/bin/env bash instead of /bin/bash
# because some folks use BSD
# use set -e instead of #!/bin/bash -e in case we're
# called with `bash ~/bin/scriptname`
set -e # bail out early if any command fails
set -u # fail if we hit unset variables
set -o pipefail # fail if any component of any pipe fails
@mihow
mihow / load_dotenv.sh
Last active August 13, 2025 15:46
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@pennestri
pennestri / katex_number_cite.html
Last active March 9, 2018 03:09
Numbering, cross referencing and copy equations in KaTex
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js"></script>
<style>
.equation {
font-size: 20px;
text-align: left;
margin: 30px 0;
margin-left: 5cm;
@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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@whistler
whistler / ofx2csv.py
Created April 19, 2015 23:32
Convert QFX/OFX to CSV
from csv import DictWriter
from glob import glob
from ofxparse import OfxParser
DATE_FORMAT = "%m/%d/%Y"
def write_csv(statement, out_file):
print "Writing: " + out_file
fields = ['date', 'payee', 'debit', 'credit', 'balance']
with open(out_file, 'w') as f:
@benley
benley / nix-profile.sh
Created January 6, 2015 07:57
tweaked nix login script
# Heavily cribbed from the equivalent NixOS login script.
# This should work better with multi-user nix setups.
export NIXPKGS_CONFIG="/etc/nix/nixpkgs-config.nix"
export NIX_OTHER_STORES="/run/nix/remote-stores/*/nix"
export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
export NIX_PROFILES="/nix/var/nix/profiles/default $HOME/.nix-profile"
export NIX_PATH="/nix/var/nix/profiles/per-user/root/channels"
export PATH="$HOME/.nix-profile/bin:$HOME/.nix-profile/sbin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$PATH"
@stefanozanella
stefanozanella / html5mathjax.cfg
Last active March 7, 2023 22:10
Custom tex4ht (htlatex) configuration, so that it generates HTML5 code with MathJax rendering
% We are generating HTML + MathML code
\Preamble{xhtml,mathml}
% We don't want to translate font suggestions with ugly wrappers like
% <span class="cmti-10"> for italic text
\NoFonts
% Don't output xml version tag
\Configure{VERSION}{}
@sjoerdvisscher
sjoerdvisscher / g-construction.hs
Last active December 26, 2015 03:19
Geometry of Interaction construction: "a way of constructing a monoidal closed category from any symmetric monoidal category with a trace operator" http://semantic-domain.blogspot.nl/2012/11/in-this-post-ill-show-how-to-turn.html
{-# LANGUAGE GADTs, TypeFamilies, TypeOperators, ScopedTypeVariables, TupleSections, NoImplicitPrelude #-}
import Data.Category
import Data.Category.Product
import Data.Category.Functor
import Data.Category.Monoidal
import Data.Category.Limit ((***))
import Data.Either
import Data.Void