This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Retrieves the home page of a project in PyPI, and opens that homepage in your default browser. | |
# This makes use of the PyPI JSON API: https://wiki.python.org/moin/PyPIJSON | |
function pypi_homepage() { curl -sL http://pypi.python.org/pypi/$1/json | \ | |
python -c "from __future__ import print_function;import json;import fileinput;\ | |
blob=json.loads(' '.join([x for x in fileinput.input()]));print(blob['info']['home_page'])"| xargs open ;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var uaParser = require('ua-parser') | |
var app = express(); | |
app.get('/', function(req,res){ | |
var r = uaParser.parse(req.headers['user-agent']); | |
res.status(200).send(r.ua.family); | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create dummy data | |
df = data.frame(id=c(1,1,1,2,2,3,3,3,4,4,4), var1=c(-2.1, 1.1, 3.14, 2.17828, 9, 10, 8,2,1,0,-1), var2=c(1,2,3,4,5,6,7,8,9,10,11)) | |
# This is what you'd see if you called this data set from the interactive prompt (or REPL, as it's called (Read-Evaluate-Print-Loop)): | |
#> df | |
# id var1 var2 | |
#1 1 -2.10000 1 | |
#2 1 1.10000 2 | |
#3 1 3.14000 3 | |
#4 2 2.17828 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jackmaney.Diophantus; | |
import com.jackmaney.Diophantus.element.Element; | |
public class Diophantus { | |
public static void main(String[] args) { | |
Element e = new Element(6,0,-5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2014-12-30 18:36:20 -0600 | |
./configure | |
--disable-dependency-tracking | |
--prefix=/usr/local/Cellar/harfbuzz/0.9.37 | |
--with-icu | |
checking for a BSD-compatible install... /usr/bin/install -c | |
checking whether build environment is sane... yes | |
checking for a thread-safe mkdir -p... ./install-sh -c -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
class RateLimitedGeocodingQueue(object): | |
def __init__(self, geocoder, addresses, per_sec_rate_limit=5): | |
self.geocoder = geocoder | |
self.addresses = [x for x in addresses] # Cloning list of addresses so we can pop with impunity | |
self.per_sec_rate_limit = per_sec_rate_limit | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted from https://github.com/python/cpython/blob/2.7/Lib/distutils/command/sdist.py#L386 | |
from distutils.text_file import TextFile | |
from distutils.filelist import FileList | |
template = TextFile("MANIFEST.in", strip_comments=1, skip_blanks=1, join_lines=1, lstrip_ws=1, rstrip_ws=1, collapse_join=1) | |
filelist = FileList() | |
try: | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Daily Programming Challenge: | |
# http://www.reddit.com/r/dailyprogrammer/comments/2xoxum/20150302_challenge_204_easy_remembering_your_lines/ | |
import requests | |
import re | |
import sys | |
macbeth = requests.get( | |
"https://gist.githubusercontent.com/Quackmatic/f8deb2b64dd07ea0985d/raw/macbeth.txt").text | |
# act_number: {scene: {description: (desc_of_scene), dialogues: [{speaker: | |
# S, text: T}]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pyenv_python_version(){ | |
result="" | |
pyenv_version="$(pyenv version-name)"; | |
if [ -n "$pyenv_version" ]; then | |
result="$pyenv_version"; | |
fi | |
[[ -n "$result" ]] && echo "($result) " | |
} | |
export PS1="\$(pyenv_python_version)\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h\[\033[33;1m\]\w\[\033[m\]$ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Process: MacDown [17345] | |
Path: /Applications/MacDown.app/Contents/MacOS/MacDown | |
Identifier: com.uranusjr.macdown | |
Version: 0.4.5.1 (647) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [445] | |
Responsible: MacDown [17345] | |
User ID: 502 | |
Date/Time: 2015-08-06 15:22:12.317 -0500 |
OlderNewer