Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Hamlett alanhamlett

View GitHub Profile
View test_oauth.py
#!/usr/bin/env python
import base64
import requests
ACCESS_TOKEN = "XXX"
APP_SECRET = "XXX"
# get some JSON, authenticating with url args
r = requests.get('https://wakatime.com/api/v1/users/current/stats/complete', params={'access_token': ACCESS_TOKEN})
View keybase.md

Keybase proof

I hereby claim:

  • I am alanhamlett on github.
  • I am alanhamlett (https://keybase.io/alanhamlett) on keybase.
  • I have a public key whose fingerprint is 2A17 98FE 2E12 3F7C BCDB E05F 76C4 315D 71A9 FECC

To claim this, I am signing this object:

@alanhamlett
alanhamlett / wakatime_github_timeline.py
Last active Aug 29, 2015
WakaTime GitHub Commit Timeline
View wakatime_github_timeline.py
""" File: views.py
"""
@blueprint.route('/project/<path:project_name>/commits')
@api_utils.nocache
@auth.login_required
def project_commits(project_name):
user = app.current_user
View django-vs-flask-worksheet.html
{% extends "common/base.html" %}
{% block subtitle %}Django vs Flask Worksheet{% endblock %}
{% block css %}
{% compress 'css' %}
<link href="{{STATIC_URL}}libs/fullpage.js/jquery.fullPage.css" rel="stylesheet" type="text/css">
<link href="{{STATIC_URL}}css/django-vs-flask-worksheet.less" rel="stylesheet" type="text/less">
{% endcompress %}
{% endblock %}
@alanhamlett
alanhamlett / utils.js
Created Sep 29, 2015
Utility Function to Map JSON errors from wtforms-json onto an HTML form
View utils.js
(function() {
var utils = {};
utils.clear_form_errors = function($el) {
$el.find('.text-danger').each(function() {
$(this).empty();
});
return $el;
};
@alanhamlett
alanhamlett / bower.json
Created Dec 14, 2015
WakaTime's bower.json JavaScript front-end dependencies
View bower.json
{
"name": "wakatime",
"version": "1.0.0",
"private": true,
"ignore": [
".jshintrc",
"**/.*",
"**/*.txt",
"test",
"tests",
View Linkedin1.6MCrackedSHA1.txt
This file has been truncated, but you can view the full file.
41b5f9baa448533dfd513f4ed1753990f59cc613:workingknowledge
deb7be5e7ca96c5b317b8a0ee13045a00e22bab5:rafaebiel
c528cf77d9cdb4ea14b43aa62cf55044e25d3b4e:kunsitint
0cbcf09868e2ec6b856eee76e7e6a9201cc60ed0:zxcasdQWE!@#
413b6507e26f3fbe388f4f5bc1f5599ff85dec1c:siapatakut
708c503230bb9a2079696386f891899a7fc15ba5:FM95jd01
400945c2ea0fa0179adb232c882fd9d8dec90424:100Senh@
e7880b9ae185f66fdfcc80d71e61154ce705f4ab:om2sanji
d819838e7f3a3d37fdc8dcb5c5cf9409d32bfbaf:bc89mod47a
@alanhamlett
alanhamlett / amqp.py
Last active Jan 3, 2018
send an error email when a Celery worker raises an unhandled exception
View amqp.py
# -*- coding: utf-8 -*-
"""
wakatime.amqp
~~~~~~~~~~~~~
Setup for Celery distributed task queue.
"""
import socket
@alanhamlett
alanhamlett / oauth-provider.py
Created Jan 18, 2017
WakaTime OAuth Provider Implementation using Flask
View oauth-provider.py
# -*- coding: utf-8 -*-
"""
wakatime.oauth.provider
~~~~~~~~~~~~~~~~~~~~~~~
OAuth 2.0 Provider.
"""
from datetime import datetime, timedelta
@alanhamlett
alanhamlett / models.py
Created Sep 22, 2014
django model manager example
View models.py
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.db import models, transaction
from django.utils import timezone
class Manager(models.Manager):
""" Use this class to define custom methods on models.
"""
def get_query_set(self):
You can’t perform that action at this time.