Skip to content

Instantly share code, notes, and snippets.

View ojarva's full-sized avatar

Olli Jarva ojarva

View GitHub Profile
import requests
class RequestsTest(requests.Session):
def __init__(self):
super().__init__()
self.headers["accept"] = "application/json"
self.params["your_api_key_here"] = "my_api_key"
def get_with_params(self, params):
@ojarva
ojarva / gist:680c628f3fd6c44bbe8c
Created January 31, 2015 20:07
owfs supervisord configuration
[program:owfs]
# - run as root (user=root)
# - allow other users to access owfs mount (--allow_other)
# - scan all USB adapters (-uall)
# - mount to /mnt/owfs
command = /usr/bin/owfs --allow_other --foreground -uall /mnt/owfs
user=root
@ojarva
ojarva / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
@ojarva
ojarva / designer.html
Last active August 29, 2015 14:14
designer
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
### Keybase proof
I hereby claim:
* I am ojarva on github.
* I am ojarva (https://keybase.io/ojarva) on keybase.
* I have a public key whose fingerprint is 4EF2 FDB8 21A5 579D 581C 061E 3586 B610 0A9D 393B
To claim this, I am signing this object:
from oauth2client.client import flow_from_clientsecrets
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.file import Storage
storage = Storage('a_credentials_file')
credentials = storage.get()
if not credentials:
flow = flow_from_clientsecrets('client_secrets.json',
scope='https://www.googleapis.com/auth/admin.reports.audit.readonly',
redirect_uri='urn:ietf:wg:oauth:2.0:oob')
import multiprocessing
def worker(parameter):
worker.queue.put("foo")
def worker_init(queue):
worker.queue = queue
queue = multiprocessing.Queue()
pool = multiprocessing.Pool(MAX_THREADS, worker_init, [queue])