Skip to content

Instantly share code, notes, and snippets.

View andyagtech's full-sized avatar

Andy Barr andyagtech

View GitHub Profile
@crazyoptimist
crazyoptimist / pyenv-install.sh
Last active December 6, 2024 13:54
Install pyenv on Ubuntu/Debian
#!/bin/bash
# Install dependencies for pyenv(because pyenv compiles python from the source)
## Debian / Ubuntu
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl
## Fedora
# sudo yum install gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel
@huttj
huttj / parseTimestamp.js
Created January 13, 2015 09:26
A simple method to parse a PostgreSQL time stamp in Safari.
// Returns the timestamp as a Date object (from the host's timezone),
// in GMT. If timestamp is *not* GMT, pass in a truthy value for isLocal.
function parseTimestamp(timestamp, isLocal) {
var z = isLocal ? 0 : new Date().getTimezoneOffset() / 60;
var t = timestamp.split(/[\- :\.]/).map(Number);
return new Date(t[0], t[1]-1, t[2], t[3]-z, t[4], t[5], t[6], t[7]);
}
var input = "2015-01-13 08:52:05.1234";
console.log(parseTimestamp(input).toString()); // 'Tue Jan 13 2015 00:52:06 GMT-0800 (Pacific Standard Time)'
@norcal82
norcal82 / city_names.js
Last active December 14, 2024 22:56
javascript array of major us city names
// javascript, coffeescript, jquery...
var city_names = ["Aberdeen", "Abilene", "Akron", "Albany", "Albuquerque", "Alexandria", "Allentown", "Amarillo", "Anaheim", "Anchorage", "Ann Arbor", "Antioch", "Apple Valley", "Appleton", "Arlington", "Arvada", "Asheville", "Athens", "Atlanta", "Atlantic City", "Augusta", "Aurora", "Austin", "Bakersfield", "Baltimore", "Barnstable", "Baton Rouge", "Beaumont", "Bel Air", "Bellevue", "Berkeley", "Bethlehem", "Billings", "Birmingham", "Bloomington", "Boise", "Boise City", "Bonita Springs", "Boston", "Boulder", "Bradenton", "Bremerton", "Bridgeport", "Brighton", "Brownsville", "Bryan", "Buffalo", "Burbank", "Burlington", "Cambridge", "Canton", "Cape Coral", "Carrollton", "Cary", "Cathedral City", "Cedar Rapids", "Champaign", "Chandler", "Charleston", "Charlotte", "Chattanooga", "Chesapeake", "Chicago", "Chula Vista", "Cincinnati", "Clarke County", "Clarksville", "Clearwater", "Cleveland", "College Station", "Colorado Springs", "Columbia", "Columbus", "Concord", "Coral Spri
@igniteflow
igniteflow / git_python_current_branch.py
Created February 7, 2012 17:33
GitPython get current active branch
"""
Gets the name of the active Git branch as a string.
Depends on GitPython
pip install GitPython
"""
from git import Repo
repo = Repo('/path/to/your/repo')
branch = repo.active_branch