Skip to content

Instantly share code, notes, and snippets.

View atkinson's full-sized avatar

Rich Atkinson atkinson

View GitHub Profile
@atkinson
atkinson / client_credentials.py
Created October 24, 2023 22:15
Client Credentials OAUTH for Spotify
import os
import requests
### This flow does not include user authorization,
### so only endpoints that do not request user information
### (e.g. user profile data) can be accessed.
### https://developer.spotify.com/documentation/web-api/concepts/authorization
SPOTIFY_CLIENT_ID = os.getenv("SPOTIFY_CLIENT_ID")
SPOTIFY_CLIENT_SECRET = os.getenv("SPOTIFY_CLIENT_SECRET")
1. Ask HN: What books changed the way you think about almost everything? - https://news.ycombinator.com/item?id=19087418
2. Ask HN: What are the best MOOCs you've taken? - https://news.ycombinator.com/item?id=16745042
3. Ask HN: How to self-learn electronics? - https://news.ycombinator.com/item?id=16775744
4. Ask HN: Successful one-person online businesses? - https://news.ycombinator.com/item?id=21332072
5. Ask HN: What's the most valuable thing you can learn in an hour? - https://news.ycombinator.com/item?id=21581361
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@atkinson
atkinson / read_zorro_history.py
Last active February 12, 2020 02:43
Sample code to read Zorro t1, t6, t8 files using Python
from ctypes import *
import os
import json
"""
The following c structure came from the Zorro manual.
See here for the structure of other files: https://manual.zorro-project.com/history.htm
"""
ZORRO_T6_FILE_TO_READ = os.path.join('.', 'AUDJPY_2009.t6')
@atkinson
atkinson / gist:9948586
Created April 3, 2014 05:09
pgmagick install on Ununtu
sudo apt-get install libgraphicsmagick++1-dev libboost-python-dev
pip install pgmagick -U
@atkinson
atkinson / gist:7999356
Created December 17, 2013 03:07
Easy jQuery templating
/*
Author: Rich Atkinson hello@piran.com.au
*/
// Provides a String.render() method. Similar to String.format() (in c),
// except it takes a literal object of name / value pairs, like context in Django.
// eg: "Hello {name} welcome to {list}".format({name: 'Joe', list: 'Spam'})
if (!String.prototype.render) {
<script type="text/javascript">
(function() {
var config = {
kitId: 'fwo5iqk',
scriptTimeout: 3000
};
var h=document.getElementsByTagName("html")[0];h.className+=" wf-loading";var t=setTimeout(function(){h.className=h.className.replace(/(\s|^)wf-loading(\s|$)/g," ");h.className+=" wf-inactive"},config.scriptTimeout);var tk=document.createElement("script"),d=false;tk.src='//use.typekit.net/'+config.kitId+'.js';tk.type="text/javascript";tk.async="true";tk.onload=tk.onreadystatechange=function(){var a=this.readyState;if(d||a&&a!="complete"&&a!="loaded")return;d=true;clearTimeout(t);try{Typekit.load(config)}catch(b){}};var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(tk,s)
})();
</script>
@atkinson
atkinson / gist:3943350
Created October 24, 2012 02:22
tengine compile options
./configure --prefix=/usr/local \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx-error.log \
--http-log-path=/var/log/nginx-access.log \
--pid-path=/var/run/nginx.pid
@atkinson
atkinson / gist:3830875
Created October 4, 2012 00:55
public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7KjcZd8MHJ8aoAdnmKR1zBISmru2VVFl6AVHQPH7s754qKTf43kp4OCjTuefje1NhpBL69MaoK6Y+Fc7gTZOx4Ofny1Ju2L8wViw6bIKdSoTOlD3NRqp28sf3doqOf1LxSXjhFrU50FEP3WhrXypCy70HbjmzN/ZSy8trAY8zsUUpi8gxRmR6KA8wThB2KgR0522X1a3mZANOjWMOhTfcedJwxcPj1ELlB7jycTEZrRuiJL3cltWy26iv4XdwdGa2gKi1HwRROYFW/fu2R6cNz2v34pI+1g2OeXRwJIe9CMQWxyha0YdSVtXVdCjCOU+21ld9baWm7UzU+8aoucUPQ== atkinsonr@gmail.com
class LoginForm(forms.Form):
password = PasswordField(
label = _("Password"))
remember = forms.BooleanField(
label = _("Remember Me"),
# help_text = _("If checked you will stay logged in for 3 weeks"),
required = False
)