This file contains hidden or 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
| from bottle import route, run, template, request | |
| import urllib.parse | |
| import requests | |
| CLIENT_ID = 'client_id' | |
| CLIENT_SECRET = 'client_secret' | |
| REDIRECT_URI = 'http://localhost:5555/oauth_line' | |
| @route('/') | |
| def index(): |
This file contains hidden or 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 requests | |
| MAPS_API_KEY = 'secret' | |
| def geocode(address): | |
| url = 'https://maps.googleapis.com/maps/api/geocode/json' | |
| params = { | |
| 'address': address, | |
| 'key': MAPS_API_KEY | |
| } |
This file contains hidden or 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 sys | |
| import requests | |
| base_url = 'https://itunes.apple.com/lookup?id=%s&entity=podcast' | |
| itunes_url = sys.argv[1] | |
| itunes_id = itunes_url.split('/id')[1].split('?')[0] | |
| r = requests.get(base_url % itunes_id).json() | |
| print(r['results'][0]['feedUrl']) |
This file contains hidden or 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 python3 | |
| # sc: size count | |
| import sys | |
| BUF_READ_SIZE = 2**24 | |
| buf_size = 0 | |
| buf = None | |
| while buf != b'': |
This file contains hidden or 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
| /* | |
| Usage: | |
| $ cc -fPIC -c now.c -I/usr/include/luaX.Y -O3 | |
| $ cc now.o -shared -o now.so | |
| In Lua: | |
| > now = require 'now' | |
| > now.now_ms() |
NewerOlder