Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
" Don't try to be vi compatible | |
set nocompatible | |
" Helps force plugins to load correctly when it is turned back on below | |
filetype off | |
" TODO: Load plugins here (pathogen or vundle) | |
" Turn on syntax highlighting | |
syntax on |
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# @kyletcarlson | |
# | |
# This skeleton also assumes you're using the following gems: |
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Bootstrap Masonry Template</title> | |
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="style.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Caption:400,700"> |
Create droplet of your liking (ubuntu 12.10 x32)
ssh to root in terminal with your server ip
ssh [email protected]
Add ssh fingerprint and enter password provided in email
#!/usr/bin/env python | |
# Example: | |
# curl -s http://jandan.net/ooxx | ./jdooxx.py -o 5 -r 2.0 -u | wget -nv -i - | |
# This will download all pictures with oo >= 5 in the last page of Jiandan OOXX. | |
import HTMLParser | |
import sys | |
import getopt |
import sys | |
from PIL import Image | |
from PIL.ExifTags import TAGS, GPSTAGS | |
def get_exif_data(image): | |
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags""" | |
exif_data = {} | |
info = image._getexif() | |
if info: |
White House petitions don't have an API yet so I wrote something quick and dirty for a specific petition in reply to a tweet by @PogoWasRight.
This thing scrapes the petition's signatures and produces histograms by state and city as a javascript file called histograms.js
.
This gist contains a snapshot copy of that file (generated when there were ~32K signatures)
This means you can either clone the gist and view index.html
, or simply use Mike Bostock's magic gist viewer.
# in controller | |
# for local files | |
send_file '/path/to/file', :type => 'image/jpeg', :disposition => 'attachment' | |
# for remote files | |
require 'open-uri' | |
url = 'http://someserver.com/path/../filename.jpg' | |
data = open(url).read | |
send_data data, :disposition => 'attachment', :filename=>"photo.jpg" |
source :rubygems | |
gem 'rake' | |
gem 'sinatra' | |
gem 'activerecord' | |
gem 'sinatra-activerecord' | |
# Adapters | |
gem 'mysql2' | |
gem 'pg' |
import cv2 | |
import cv2.cv as cv | |
def detect(img, cascade_fn='haarcascades/haarcascade_frontalface_alt.xml', | |
scaleFactor=1.3, minNeighbors=4, minSize=(20, 20), | |
flags=cv.CV_HAAR_SCALE_IMAGE): | |
cascade = cv2.CascadeClassifier(cascade_fn) | |
rects = cascade.detectMultiScale(img, scaleFactor=scaleFactor, |