Skip to content

Instantly share code, notes, and snippets.

View g-andrade's full-sized avatar

Guilherme Andrade g-andrade

  • Dash Games
  • Lisbon, Portugal
  • 02:53 (UTC +01:00)
View GitHub Profile
@dtheodor
dtheodor / listen_sqla.py
Last active February 17, 2025 19:04
Listen for pg_notify with SQL Alchemy + Psycopg2
import select
import datetime
import psycopg2
import psycopg2.extensions
from sqlalchemy import create_engine, text
engine = create_engine("postgresql+psycopg2://vagrant@/postgres")
@MercuryRising
MercuryRising / gravitytrain.py
Created August 28, 2013 21:19
Hypocycloid Gravity Train
# -*- coding: utf-8 -*-
from math import *
import wolframalpha
client = wolframalpha.Client("YHQ3GK-PT45KT9AHG")
radius = 6367500
circumference = 2*pi*radius
gravitational_constant = 9.8 # m/s2
@indygreg
indygreg / find_old_lines.pl
Created June 17, 2012 20:17
Find oldest lines in git repository
#!/usr/bin/perl
# This script parses Git blame's "porcelain" output format and
# ascertains the oldest lines of code seen.
#
# If you want to perform a custom report, just define your own callback
# function and invoke parse_porcelain() with it.
#
# The expected input format is slightly modified from raw `git blame
# -p`. Here is an example script for producing input: