Skip to content

Instantly share code, notes, and snippets.

View georghildebrand's full-sized avatar

ghildebrand georghildebrand

  • EU
View GitHub Profile
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jboner
jboner / latency.txt
Last active June 22, 2025 10:14
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 20, 2025 16:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 17, 2025 06:11
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@thekuffs
thekuffs / postgres.sls
Last active August 22, 2020 01:49 — forked from rca/postgres.sls
postgresql:
service:
- running
- require:
- pkg: postgres_pkgs
postgres_pkgs:
pkg.installed:
- pkgs:
@vy
vy / AllPairsShortestPath.scala
Created February 28, 2013 12:57
Floyd-Warshall all-pairs-shortest-path algorithm in Scala.
/**
* Returns shortest paths between all pairs using Floyd-Warshall algorithm.
* Nodes are assumed to be enumerated without any holes and enumeration
* starts from 0.
*
* @param nodes the set of vertices
* @param links the map of edges with costs
* @return shortest paths between all pairs, including the source and destination
*/
def allPairsShortestPath(nodes: Set[Int], links: Map[Int, Set[Int]]): Map[Int, Map[Int, Seq[Int]]] = {
@andrequeiroz
andrequeiroz / holtwinters.py
Last active February 3, 2025 04:35
Implementation of Holt-Winters algorithms in Python 2
#The MIT License (MIT)
#
#Copyright (c) 2015 Andre Queiroz
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
@mmueller
mmueller / git
Last active September 8, 2024 23:58
This is a bash script that wraps git and lets you implement pre- or post-command hooks that apply to git globally (not per-repository). Out of the box, this script has a post_clone and post_init hook that do the same thing: prompt you to verify that the author information (user.name and user.email) are correct for the given repository -- prevent…
#!/bin/bash
#
# This script wraps git, so install it somewhere such as ~/bin where
# it will be found by your shell before the actual git executable.
set -e
# Extract the command from a git command line
function get_command {
while [[ "$1" =~ ^- ]]; do
import numpy as np
def GEPP(A, b, doPricing = True):
'''
Gaussian elimination with partial pivoting.
input: A is an n x n numpy matrix
b is an n x 1 numpy array
output: x is the solution of Ax=b
with the entries permuted in