Skip to content

Instantly share code, notes, and snippets.

Avatar

Sophia Feng fengs

  • San Francisco
View GitHub Profile
View vr_listing.xml
<?xml version="1.0"?>
<listing xmlns="http://www.airbnb.com/schemas/airbnb-listing/v1" schemaVersion="1.0">
<lastUpdated>2017-08-29T16:36:15Z</lastUpdated>
<published>true</published>
<basicDetails>
<bathrooms>1</bathrooms>
<bedrooms>1</bedrooms>
<propertyType>house</propertyType>
<listingType>entire_home</listingType>
<amenities>
View Smart_Cat_large_image.xml
<?xml version="1.0"?>
<listing xmlns="http://www.airbnb.com/schemas/airbnb-listing/v1" schemaVersion="1.0">
<lastUpdated>2017-04-15T17:27:40Z</lastUpdated>
<published>true</published>
<basicDetails>
<bathrooms>3</bathrooms>
<bedrooms>3</bedrooms>
<propertyType>house</propertyType>
<listingType>entire_home</listingType>
<amenities>
@fengs
fengs / tumblr-photo-ripper.rb
Last active Aug 29, 2015 — forked from jamiew/tumblr-photo-ripper.rb
Download all the images from a Tumblr blog
View tumblr-photo-ripper.rb
# Usage:
# [sudo] gem install mechanize
# ruby tumblr-photo-ripper.rb
require 'rubygems'
require 'mechanize'
# Your Tumblr subdomain, e.g. "jamiew" for "jamiew.tumblr.com"
site = "doctorwho"
@fengs
fengs / OSPath.py
Created Apr 21, 2014
Usage of os.path method of the os module. From http://www.diveintopython3.net/comprehensions.html
View OSPath.py
>>> import os
>>> print(os.path.join('/Users/pilgrim/diveintopython3/examples/', 'humansize.py'))
/Users/pilgrim/diveintopython3/examples/humansize.py
>>> print(os.path.join('/Users/pilgrim/diveintopython3/examples', 'humansize.py'))
/Users/pilgrim/diveintopython3/examples\humansize.py
>>> print(os.path.expanduser('~'))
c:\Users\pilgrim
>>> print(os.path.join(os.path.expanduser('~'), 'diveintopython3', 'examples', 'humansize.py'))
c:\Users\pilgrim\diveintopython3\examples\humansize.py
@fengs
fengs / scp
Created Apr 21, 2014
Secure copy to/from remote host using scp and ssh
View scp
# make sure ssh-client is installed
# login
$ ssh user@remotehost
# generating key pairs
$ ssh-keygen -t dsa
# install the key by either of the commands
$ scp ~/.ssh/id_dsa.pub user@remotehost:.ssh/authorized_keys
@fengs
fengs / ParsePhoneNumber.py
Created Apr 19, 2014
Parse American phone numbers, with optional extension
View ParsePhoneNumber.py
import re
phonePattern = re.compile(r'''
(\d{3}) #area code
\D*
(\d{3}) #trunk
\D*
(\d{4}) #number
\D*
(\d*) #optional extension
View gcd.py
>>> from fractions import gcd
>>> gcd(20,8)
4
>>> print inspect.getsource(gcd)
def gcd(a, b):
"""Calculate the Greatest Common Divisor of a and b.
Unless b==0, the result will have the same sign as b (so that when
@fengs
fengs / 0_reuse_code.js
Created Apr 16, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.