Skip to content

Instantly share code, notes, and snippets.

curl 'http://www.napaonline.com/pa/philadelphia/mechanics-auto'
-H 'Host: www.napaonline.com'
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0'
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
-H 'Accept-Language: en-US,en;q=0.5' --compressed
-H 'Connection: keep-alive'
-H 'Cookie: D_SID=73.160.108.26:gL/pcVXaWORFEUVp5LdvI8TzMyho15lhjwvJ99mLPRk; D_PID=3119DF0B-3C06-308A-88B4-6118E4B86D16; D_IID=537F6159-CBB6-39AF-B0EB-3FB67E6AE7A1; D_UID=73B0C82A-856C-3071-810D-3741B7285A52; D_HID=JvZnDFfJrbcyzrowMossc7nUpelw7rwBvDgfDnfvXYY; .ASPXANONYMOUS=dgx-Q9oW0QEkAAAAOTEzOTk5MDItMDI2Yy00ZmQ4LWIwNjAtYTNjYmExZTNmYmQ26nSaDOnkO-Y0VUrxvqiWnywbE-E1; __utma=44732731.1803377310.1440949231.1440949231.1440954475.2; __utmz=44732731.1440949231.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); AMCV_Genuine%20Parts%20Company%40AdobeOrg=136688995%7CMCMID%7C17924727585726661166837957770550610914%7CMCAAMLH-1441554031%7C7%7CMCAID%7CNONE; s_nr2=1440954476
import sys
import requests
from pyquery import PyQuery
# Clothing items holds all the info needed to display a clothing item from
# any source.
class ClothingItem(object):
def __init__(self, name, price, imageURL, itemURL):
super(ClothingItem, self).__init__()
@vivekseth
vivekseth / github-oauth.py
Created December 25, 2015 20:25 — forked from anonymous/github-oauth.py
This python script outputs an OAuth Authorization token for use with Github's API. Username and password are inputted via STDIN, and the authorization token is outputted on STDOUT.
import requests
import base64
import json
import random
import string
username = raw_input()
password = raw_input()
fingerprint = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
@vivekseth
vivekseth / generic-oauth.py
Created December 26, 2015 02:49
This python file contains the abstract class `OAuthWebFlowController` which will makes implementing oauth for use in a GUI-less application easier. All you need to do is implement 2 methods: `authorization_url()` and `temp_code_to_access_code()`. Included are implementations for Google, Github, Facebook, and Spotify
import random
import string
import webbrowser
import urlparse
import requests
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
# NEED TO FILL OUT THESE VALUES
_client_id = ''
_client_secret = ''
@vivekseth
vivekseth / get_title_and_url.applescript
Created April 16, 2016 20:39 — forked from vitorgalvao/Get Title and URL.applescript
Applescript to get frontmost tab’s url and title of various browsers.
# Keep in mind that when asking for a `return` after another, only the first one will be output.
# This example is meant as a simple starting point, to show how to get the information in the simplest available way.
# Google Chrome
tell application "Google Chrome" to return URL of active tab of front window
tell application "Google Chrome" to return title of active tab of front window
# Google Chrome Canary
tell application "Google Chrome Canary" to return URL of active tab of front window
tell application "Google Chrome Canary" to return title of active tab of front window
# Chromium
@vivekseth
vivekseth / sompy_1.ipynb
Created April 20, 2016 15:37 — forked from melgor/sompy_1.ipynb
SOMPY Tutorial 1 Refactored
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function convertToJSON(obj) {
function traverse(root, visited, level) {
if (level > 4) {
return '<<'+level+' levels>>';
}
if (!root) {
return '<<null root>>'
}
if (visited.indexOf(root) >= 0) {
return '<<visited>>';
@vivekseth
vivekseth / FeatureDetection.py
Last active January 4, 2017 17:04
Gentle Intro to OpenCV
import cv2
import numpy as np
def magnitude(image, pos):
x, y = pos
return np.mean(image[x, y])
def isPeak(image, pos, threshold):
x, y = pos
mag = magnitude(image, pos)
import cv2
image = cv2.imread('./4.2.04.tiff')
# Since OpenCV uses BGR, this code will correctly remove the red channel
image[:, :, 2] = 0
cv2.imshow('Hello World', image)
k = cv2.waitKey(0)
def magnitude(image, pos):
x, y = pos
return np.mean(image[x, y])
def isPeak(image, pos, threshold):
x, y = pos
mag = magnitude(image, pos)
for i in range(x-1, x+1):
for j in range(y-1, y+1):
if i == x and j == y: