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
# template for "Guess the number" mini-project | |
# input will come from buttons and an input field | |
# all output for the game will be printed in the console | |
# Mini Project 2 for An Introduction to Interactive Programming in Python | |
# URL http://www.codeskulptor.org/#user39_L4LKshd1tOatpPt_2.py | |
import random | |
import simplegui |
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
# Install xcode command line tools | |
xcode-select --install | |
# Install home brew | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# Install git | |
brew install git | |
# Install python |
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
sudo apt-get update | |
sudo apt-get install -y git-core curl zlib1g-dev build-essential \ | |
libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 \ | |
libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common nodejs | |
# Install rbenv | |
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile |
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
# Install pip in for an virtualenv, from digital ocean documents | |
curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python2.7 - | |
pip install virtualenv | |
virtualenv venv |
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
In [1]: import reverse_geocoder as rg | |
In [2]: coordinates = (39.99, 116.48), | |
In [3]: results = rg.search(coordinates) | |
Loading formatted geocoded file... | |
In [4]: print results | |
[{'name': 'Wangjing', 'cc': 'CN', 'lon': '116.47284', 'admin1': 'Beijing', 'admin2': '', 'lat': '39.9933'}] |
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
import schedule | |
import time | |
def scheduled(t): | |
def wrapper(func): | |
schedule.every(7).days.at(t).do(func) | |
while True: | |
schedule.run_pending() | |
time.sleep(1) |
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
#!/bin/bash | |
unset LANG # deal with "illegal byte sequence" error | |
for filename in *txt; do | |
echo $filename | |
ex $filename "+set ff=unix fileencoding=utf-8" "+x" | |
done |
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
#!/usr/bin/env python | |
#-*-coding: utf-8 -*- | |
import urllib2 | |
import sys | |
def load_url(f): | |
return [line.strip() for line in open(f)] | |
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 CONSUMER_KEY = "<< YOUR KEY HERE >>"; | |
var CONSUMER_SECRET = "<< YOUR SECRET HERE >>"; | |
function getConsumerKey() { | |
return CONSUMER_KEY; | |
} | |
function getConsumerSecret() { | |
return CONSUMER_SECRET; | |
} |
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
Graph: | |
{'a': {'d': 1, 'g': 1}, 'c': {'g': 1}, 'b': {'f': 1}, 'e': {'h': 1, 'f': 1}, 'd': {'a': 1, 'g': 1}, 'g': {'a': 1, 'c': 1, 'd': 1}, 'f': {'b': 1, 'e': 1}, 'h': {'e': 1}} | |
List example: | |
set(['a', 'c', 'd', 'g']) | |
set(['a', 'c', 'd', 'g']) | |
Dict example: | |
{'a': True, 'c': True, 'd': True, 'g': True} | |
{'a': True, 'c': True, 'd': True, 'g': True} |
OlderNewer