Skip to content

Instantly share code, notes, and snippets.

View papajuans's full-sized avatar
🙃

Ryan J papajuans

🙃
  • NY
View GitHub Profile
import simplejson
import urllib
import PyRSS2Gen
hn_url = "http://news.ycombinator.com/"
#Run the YQL and get the JSON back
yql_url = "http://query.yahooapis.com/v1/public/yql?q=%20select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fnews.ycombinator.com%2Fnewest%22%20and%20xpath%3D'%2F%2Ftd%5B%40class%3D%22title%22%5D%2Fa'&format=json&callback="
yql_results = urllib.urlopen(yql_url) #The query will return JSON
yql_json = simplejson.load(yql_results)
#!/bin/bash
#Declare array
declare -a ARRAY
#Open file for reading to array
exec 10<urls.txt
let count=0
while read LINE <&10; do
url=$LINE
hiturl="http://localhost:8000${LINE}"
" Show syntax coloring
syntax enable
set tabstop=4
set autoindent
set hls
colorscheme desert
" Show line numbers
" set number
#!/bin/bash
LOCAL_BASHRC_VER="1.7.3"
#
# !!! DO NOT FORGET TO UPDATE LOCAL_BASHRC_VER WHEN COMMITTING CHANGES !!!
#
# $Id: .bashrc 432 2006-09-12 19:15:05Z bklang $
# v1.7.3 Add missing 1.7.3 version tag and alkaloiddev network
# Rev 420: This one goes out to Bryan
# Mute perl warnings (deja-vu?)
# Reset term color after printing PATH warning
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.4.3', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.6/site-packages/virtualenv-1.4.3-py2.6.egg/virtualenv.py", line 528, in main
use_distribute=options.use_distribute)
File "/Library/Python/2.6/site-packages/virtualenv-1.4.3-py2.6.egg/virtualenv.py", line 611, in create_environment
site_packages=site_packages, clear=clear))
File "/Library/Python/2.6/site-packages/virtualenv-1.4.3-py2.6.egg/virtualenv.py", line 689, in install_python
for fn in os.listdir(stdlib_dir):
OSError: [Errno 13] Permission denied: '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages'
@papajuans
papajuans / vimrc
Created June 12, 2011 19:15
my vimrc
" Cobbled together from the internet (mostly from
" rtomayko's dotfiles on github:
" http://github.com/rtomayko/dotfiles/blob/rtomayko/.vimrc)
" ----------------------------------------------------------
" GENERAL
" ----------------------------------------------------------
set nocompatible " No vi compatibility
set history=1000 " lots of history
@papajuans
papajuans / gist:5545154
Created May 9, 2013 02:25
promise slideshow-service
vagrant@precise64:~$ ab -k -c 5 -n 100 http://10.201.240.68:3002/slideshows
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.201.240.68 (be patient).....done
Server Software:
Server Hostname: 10.201.240.68
@papajuans
papajuans / gist:5545160
Created May 9, 2013 02:27
req-perf-rewrite slideshow
vagrant@precise64:~$ ab -k -c 5 -n 100 http://10.201.240.68:3002/slideshows
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.201.240.68 (be patient).....done
Server Software:
Server Hostname: 10.201.240.68
@papajuans
papajuans / bulk.js
Created June 3, 2013 20:37
Bulk get
// Expecting something like /photos/bulk?ids=123,456
app.get('/photos/bulk', function(req, res, next) {
var ids = req.query.ids.split(',');
Photo.find({_id : {$in: ids}}, function(err, photos) {
if(err) {
next(err)
} else if (photos) {
var wrapped = {};
for(var i = 0; i < photos.length; i++) {
var p = photos[i];
@papajuans
papajuans / makehub
Created November 5, 2015 23:04
Hello World
# Title
Hello World
# Picture
media: undefined
# Objective
undefined
# Duration
undefined
# Age Group
undefined