Skip to content

Instantly share code, notes, and snippets.

View jstacoder's full-sized avatar
:octocat:
working

Kyle J. Roux jstacoder

:octocat:
working
View GitHub Profile
@jstacoder
jstacoder / basecamp_requests.py
Created November 24, 2014 09:04
Simple Basecamp Authorization with python
from requests import Session # get the class to subclass
# setup your variables in the class
class BasecampSession(Session):
_username = ''
_password = ''
_basecamp_account_number = ''
_basecamp_api_url = 'https://basecamp.com/{}/api/v1/'
def __init__(username,password,bc_account_number,*args,**kwargs):
@jstacoder
jstacoder / make_page.py
Last active August 29, 2015 14:10
programatic page generation with flask-htmlbuilder
#!/usr/bin/python
try:
from htmlbuilder import html
except ImportError:
import sys
print '\n'.join(sys.path)
sys.exit()
from flask import Flask
add_styles = (
(lambda flask:
(lambda Flask:
(lambda app:
(lambda hello:
[f() for f in [
lambda : app.route("/")(hello),
lambda : app.run() if __name__ == "__main__" else None
]
][-1]
)(lambda :
from flask import Flask
app = Flask('__name__')
@app.route('/')
def index():
return 'Hello World!'
app.run()
@jstacoder
jstacoder / lambda.py
Last active August 29, 2015 14:10 — forked from e000/lambda.py
########################################################
# How to NOT use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda const-#
# ruct in Python 2.x. DO NOT USE ANY OF THIS EVER #
# by: e000 (13/6/11) #
########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much annymous "one line" functions
@jstacoder
jstacoder / lambda.py
Last active August 29, 2015 14:10 — forked from e000/lambda.py
########################################################
# How to NOT use Lambdas. An inneficient and yet educa-#
# tonal guide to the proper misuse of the lambda const-#
# ruct in Python 2.x. DO NOT USE ANY OF THIS EVER #
# by: e000 (13/6/11) #
########################################################
## Part 1. Basic LAMBDA Introduction ##
# Well, it's worth diving straight into what lambdas are.
# Lambdas are pretty much annymous "one line" functions
@jstacoder
jstacoder / basecamp_api.py
Last active August 29, 2015 14:10
multi-threaded requests to the new basecamp json api
import requests
class BasecampApi(object):
_username = ''
_password = ''
_account_number = ''
_base_url = 'https://{}:{}@basecamp.com/{}/api/v1/'
def __init__(self,user,pw,acct_num):
self._user = user
@jstacoder
jstacoder / app.py
Last active August 29, 2015 14:11
fully scripted basecamp oauth api authentication, via mechanize with a little help from Flask
import flask
app = flask.Flask(__name__)
# for this to work you need to register your redirect uri to SERVER_IP/auth/confirm
@app.route('/auth/confirm')
def get():
return flask.jsonify(dict(code=flask.request.args.get('code',None)))
@jstacoder
jstacoder / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jstacoder
jstacoder / python_resources.md
Last active August 29, 2015 14:13 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides