Skip to content

Instantly share code, notes, and snippets.

import requests
from bs4 import BeautifulSoup
r = requests.get("http://www.sciencemag.org/content/current")
soup = BeautifulSoup(r.content)
data = soup.findAll("div", {"class":"level2"})
#Find the "research article" and get it's index.
import requests
STEAM_API_KEY = "your_api_key"
r = requests.get("http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key="+ STEAM_API_KEY + "&steamid=76561197973685973&format=json")
data = r.json()["response"]["games"]
for game in data:
print game["playtime_forever"], game["appid"]
{
u'startDate':1381820400000 L,
u'bpiSeries':{
u'data':[
{
u'y':824,
u'x':1381820400000 L
},
{
u'y':1008,
import json
j = '$(function() {Lumos.TrainerApp.History.Summaries.Show.init({"bpiSeries":{"name":"BPI","id":"overall","data":[{"x":1381820400000,"y":824},{"x":1381993200000,"y":1008},{"x":1382079600000,"y":1056},{"x":1382166000000,"y":1161},{"x":1382252400000,"y":1198},{"x":1382511600000,"y":1246},{"x":1383289200000,"y":1238},{"x":1383638400000,"y":1255},{"x":1383897600000,"y":1277},{"x":1383984000000,"y":1255},{"x":1384156800000,"y":1301},{"x":1404457200000,"y":1244},{"x":1405062000000,"y":1242},{"x":1406012400000,"y":1237},{"x":1406185200000,"y":1213},{"x":1408690800000,"y":1229},{"x":1409036400000,"y":1234}]},"calendarData":[{"date":1406444400000,"data":{"bac_counts":{"data":[]},"bpi_change":{"overall":{"bpi_change":0,"new_bpi":1213},"Speed":{"bpi_change":0,"new_bpi":1245},"Memory":{"bpi_change":0,"new_bpi":910},"Attention":{"bpi_change":0,"new_bpi":1003},"Flexibility":{"bpi_change":0,"new_bpi":1392},"Problem Solving":{"bpi_change":0,"new_bpi":1496}},"results":{"Speed":[],"Memory":[],"Attention":[],"Flexi
; The official HD AI
; An Artificial Intelligence Script written by Archon and Promiskuitiv
; Get in contact with Promiskuitiv by sending a mail to neuernamae@web.de
; List of taunts it reacts to:
; Standard taunts.
; 33 - Stop slinging resources. If slinging is requested early and is immediately canceled it may mess up the strategy.
; 38 - Sling Resources. Human player only, stops any unit production except for civilian units.
@Andygmb
Andygmb / tables
Last active August 29, 2015 14:10
For keeping history of people registered to the RUGC trading systems, tracking IP's, alternate accounts, new accounts, multiple logins from different accounts on the same ip or same reddit account.
-------------------------------------------------------------------------------------------------------------
Registered Users Table
Primary Key | Reddit | Steam | IP | Status |
1 | andygmb | 000000000000000000 | 0.0.0.0 | Banned |
@/subreddit/register
Sign in with reddit + steam
return AJAX loading page that sends a request to /subreddit/registration_status every (?) seconds for status on query
@/subreddit/registration_status
Check steamrep status (API request to steamrep.com)
class Parent(Base):
__tablename__ = 'parent'
id = Column(Integer, primary_key=True)
children = relationship("Child0"), relationship("Child1"), relationship("Child2")
class Child0(Base):
__tablename__ = 'child'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('parent.id'))
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
wrap: function (x, min, max){
return x < 0 ? max + x : min
},
get_neighbour:function(x, y) {
if (g.grid[x] && g.grid[x][y]){
return g.grid[x][y].state
} else // else the number is out of bounds{
x = g.func.wrap(x, 0, 500);