Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
# Copyright (C) 2010 Samuel Abels.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@clach04
clach04 / hb_all_books_dl.js
Created February 15, 2017 19:52 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
$('a').each(function(i){
if ($.trim($(this).text()) == 'MOBI') {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}
});
@clach04
clach04 / hb_all_books_dl.js
Created February 15, 2017 19:52 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
$('a').each(function(i){
if ($.trim($(this).text()) == 'EPUB') {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}
});
@clach04
clach04 / README.txt
Created December 21, 2018 19:18 — forked from zostay/README.txt
Google Authentication Workflow for Pebble Watchapps
None of the workflow examples given in the Google Authentication OAuth2 documentation
(https://developers.google.com/accounts/docs/OAuth2) handle what's needed for Pebble. I
basically had to mix the needs of a client-side application with an offline web application
to get what's needed and work within the restrictions of the Pebble JS toolkit.
The steps are as follows:
1. Setup a Client ID for Web Application on the Google Developer Console
2. On the configuration web pages, with SSL:
* In the configuration page, use JavaScript to retrieve a authorization code, which
@clach04
clach04 / README.md
Last active July 23, 2022 21:47 — forked from zeevro/README.md
Pebble SDK installation script
#!/usr/bin/env python
"""Utility methods for Google Spreadsheets based on gspread library.
Used mostly for logging.
http://hakanu.net/2014/09/14/how-i-store-server-logs-in-google-spreadsheets/
Here are the dependecies:
sudo apt-get install python-pip python-dev build-essential
sudo easy_install gspread
"""
#!python
## sudo apt-get install python3-evdev
# Tested with `SC-8110-2D-B` 1d & 2d barcode scanner
#
# Inspired by https://github.com/julzhk/usb_barcode_scanner
# which was inspired by https://www.piddlerintheroot.com/barcode-scanner/
# https://www.raspberrypi.org/forums/viewtopic.php?f=45&t=55100
# from 'brechmos' - thank-you!
#
@clach04
clach04 / sjcl_simple
Created March 20, 2022 00:15 — forked from g-p-g/sjcl_simple
SJCL encrypt / decrypt in Python
import os
from base64 import b64decode, b64encode
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from cryptography.hazmat.backends import default_backend
_BACKEND = default_backend()
@clach04
clach04 / README.md
Created July 21, 2022 17:10 — forked from fantix/README.md
Wire Protocol of PostgreSQL Queries in a Nutshell
@clach04
clach04 / psql-srv.py
Created July 21, 2022 17:27 — forked from eatonphil/psql-srv.py
postgres "server" wire protocol example (ported python3)
# th30z@u1310:[Desktop]$ psql -h localhost -p 55432
# Password:
# psql (9.1.10, server 0.0.0)
# WARNING: psql version 9.1, server version 0.0.
# Some psql features might not work.
# Type "help" for help.
#
# th30z=> select foo;
# a | b
# ---+---