Skip to content

Instantly share code, notes, and snippets.

View nootrope's full-sized avatar
💭
Pushing bits

Alberto Gaitán nootrope

💭
Pushing bits
  • planet earth
View GitHub Profile
@nootrope
nootrope / disable_inline.applescript
Last active December 18, 2015 16:49
Disable inline attachments in Apple Mail
defaults write com.apple.mail DisableInlineAttachmentViewing -bool yes
@nootrope
nootrope / enable_inline.applescript
Created June 19, 2013 14:26
Enable inline attachments in Apple Mail
defaults write com.apple.mail DisableInlineAttachmentViewing -bool false
@nootrope
nootrope / showHiddenFilesOSX109
Created February 23, 2014 18:35
Show hidden files in OS X 10.9 Finder
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
@nootrope
nootrope / hideHiddenFilesOSX109
Created February 23, 2014 18:39
Hide hidden files in OS X 10.9 Finder
defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder
# From http://www.raspberrypi.org/forum/viewtopic.php?f=29&t=6722
#
# For a Raspberry Pi
sudo modprobe snd_bcm2835
@nootrope
nootrope / gps_haversine.py
Last active August 29, 2015 14:04
Python implementation of the Haversine function to convert GPS coords to kilometers and miles.
def haversine(pos1, pos2):
# From http://stackoverflow.com/a/18144531/3788069
lat1 = float(pos1['lat'])
long1 = float(pos1['long'])
lat2 = float(pos2['lat'])
long2 = float(pos2['long'])
degree_to_rad = float(pi / 180.0)
d_lat = (lat2 - lat1) * degree_to_rad

Keybase proof

I hereby claim:

  • I am nootrope on github.
  • I am nootrope (https://keybase.io/nootrope) on keybase.
  • I have a public key whose fingerprint is CDDC 165A 26AA 3C4F 5AAF 818B E24A F715 6854 43AE

To claim this, I am signing this object:

@nootrope
nootrope / pyvenv-pip.txt
Last active August 29, 2015 14:12
Python3 workaround for broken pyvenv with pip, in Ubuntu 14.04
# From: https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/1290847
# Using /tmp/ as example destination for venv
$ python3 -m venv --without-pip /tmp/env
$ curl https://bootstrap.pypa.io/get-pip.py | /tmp/env/bin/python
@nootrope
nootrope / javascript-query-string.js
Last active September 21, 2015 00:43 — forked from DavidWells/javascript-query-string.js
JavaScript :: Regex trick: Parse a query string into an object
// http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
// JavaScript regex trick: Parse a query string into an object
var queryString = {};
anchor.href.replace(
new RegExp("([^?=&]+)(=([^&]*))?", "g"),
function($0, $1, $2, $3) { queryString[$1] = $3; }
);
// Usage
@nootrope
nootrope / gist:81fb593a1cf1131dd227
Last active September 21, 2015 00:44 — forked from DavidWells/gist:ed7324739059cea4ee8d
git ignore for wordpress project
# WPEngine Deploy - wp-content folder #
###########################################
# Ignore all files except for the wp-content directory
*
# Don't ignore directories themselves, else we can't add anything to the repository
!*/
# Don't ignore the the following directory
!**/wp-content/*
# or its subdirectories