Skip to content

Instantly share code, notes, and snippets.

View amitu's full-sized avatar
😀
Building fastn.com

Amit Upadhyay amitu

😀
Building fastn.com
View GitHub Profile
#!/usr/bin/python
# to try this you'll need to edit in the name of your ruby binary and install bcc-tools
# bcc installation instructions are at https://github.com/iovisor/bcc/blob/master/INSTALL.md
from __future__ import print_function
from bcc import BPF
from time import sleep
import os
# load BPF program
@pklaus
pklaus / print_contacts_from_address-book.py
Created June 16, 2011 18:24
How to access the Mac OS X Address Book from Python: <http://www.programmish.com/?p=26>
import objc
import AddressBook as ab
import pprint as pp
def pythonize(objc_obj):
if isinstance(objc_obj, objc.pyobjc_unicode):
return unicode(objc_obj)
elif isinstance(objc_obj, ab.NSDate):
return objc_obj.description()

A Beginner's Hip Hop Playlist

Edit: After some constructive feedback on hacker news, I think that it's worth mentioning that this playlist is very skewed towards recent material, although I've included some essentials from the past.

I think that hip hop is one of the most, if not the most, misunderstood genres of music. In this playlist, rather than focusing on one artist or one type of hip hop, I tried to give examples of a bunch of different artists with songs ranging from the early 90's all the way up until 2017. The songs are in no particular order and the sounds cover a very broad spectrum. Some of them are pretty damn explicit, so I wouldn't necessarily throw this playlist on if there are kids around. I provided the lyrics to each song, the sub-genre that I'd put the artist in (very rough), and a brief description. This playlist is not by any means meant to be comprehensive and in many cases doesn't necessarily represent the artist's "best" song, but instead aims at exposing you to some of my fa

@kogakure
kogakure / fabfile.py
Created October 17, 2009 14:20
Python: Fabric 0.9/1.x - Synchronize files with rsync
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Fabric 0.9/1.x – Synchronize files in a project folder with webserver
from fabric.api import env
from fabric.contrib.project import rsync_project
env.hosts = ['domain.com']
env.path = '/home/user/project/'
#!/usr/bin/env ruby
require 'base64'
require 'open-uri'
# file or url
def get_css(src)
if src.start_with? 'http'
src = src.gsub('|', '%7C')
STDERR.puts "# GET #{src}"
# simulate modern browser to get woff
@chrisclark
chrisclark / pypi-release-checklist.md
Last active April 3, 2018 13:17 — forked from audreyfeldroy/pypi-release-checklist.md
SQL Explorer Release Checklist
  • Update HISTORY
  • Update README and check formatting with http://rst.ninjs.org/
  • Make sure any new files are included in MANIFEST.in
  • Update version number in explorer/__init__.py
  • Update any package dependencies in setup.py
  • Commit the changes:
git add .
git commit -m "Release 1.0.0"
@chalmagean
chalmagean / onSelect.elm
Last active December 22, 2016 06:21
Elm onSelect decoder
-- Assuming we have a list of items in the model (type alias Model = { items : List Item }
-- where Item is a record like { id : Int, name : String }
-- this goes in the view and generates an html dropdown
select
[ onSelect ValueSelectedMsg ]
(List.map (\item -> option [ value (toString item.id) ] [ text item.name ]) model.items)
targetSelectedIndex : Json.Decoder Int
@dcramer
dcramer / fix_requests.py
Last active December 11, 2015 21:28
Because you should maintain API compatibility when you tell everyone to use your shit.
from requests.models import Response
class fixedjson(object):
def __init__(self, func):
self.func = func
def __get__(self, inst, cls):
result = self.func(inst)
class proxy(type(result)):
@kingel
kingel / php.cfg
Created October 29, 2012 10:22
phpbuildout
# ===================================================================
# Builds PHP as an Apache module (Apache profile needed)
[buildout]
extends =
apache.cfg
mysql.cfg
# Buildout parts
parts +=
png-build
@mrdoob
mrdoob / gist:3504382
Created August 28, 2012 21:09
Encoding png sequence + audio into a webm with good quality.
ffmpeg -r 24 -i sequence/%d.png -i audio.aif -g 120 -level 216 -profile 0 -qmax 42 -qmin 10 -rc_buf_aggressivity 0.95 -vb 2M video.webm