Skip to content

Instantly share code, notes, and snippets.

Tim Richardson timrichardson

Block or report user

Report or block timrichardson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:e08ed9343b5542426c8cebba7385a9bf
--- TLP 1.2.2 --------------------------------------------
+++ Configured Settings: /etc/default/tlp
TLP_ENABLE=1
TLP_DEFAULT_MODE=AC
TLP_PERSISTENT_DEFAULT=0
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
@timrichardson
timrichardson / gmail_signature_editing.py
Last active Jan 27, 2019
Modern way to edit gmail signatures with python3 and the gmail API
View gmail_signature_editing.py
from string import Template
import time
import pytest
from google.oauth2 import service_account
from googleapiclient.discovery import build
from googleapiclient.errors import *
from google.auth.exceptions import *
import easygui
import pandas as pd
@timrichardson
timrichardson / 0_reuse_code.js
Created Jul 22, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@timrichardson
timrichardson / gmail_signatures.py
Last active Jan 27, 2019
Use Python, OAuth2 and Google APIs to mass-update gmail signatures of a Google Apps for Work domain. Using a google service account for the credential.
View gmail_signatures.py
# python 2.7
# *********************************************************************************************************
#
#
#
# Please see https://gist.github.com/timrichardson/e6ee6640a8b7fe664f3a5a80406ca980
#
# for a modern way of doing this, using the current API and python 3
#
@timrichardson
timrichardson / unleashed_api.py
Created Apr 30, 2015
Some examples of Unleashed API in Python 3.4
View unleashed_api.py
__author__ = 'tim'
import requests.auth
import binascii
import hashlib
import hmac
import prefs
import json
# tested only with python 3.4
@timrichardson
timrichardson / 0_ Gmail API for Service Accounts Python 2.7.
Last active Oct 29, 2018
Access gmail via gmail api, Service Account method (applicable if you have Google Apps admin access)
View 0_ Gmail API for Service Accounts Python 2.7.
smtp mail sending in cPython blocks the GIL.
This code is tested on python 2.7.8 and I'm using it with web2py
If you use Google Apps for your domain email and if you have admin access, you can easily use the gmail api.
Because you have admin access, you can create a "service account" in the Google Developer Console.
This makes authentication easy.
There are other authorisation methods when you don't have admin access, but they require interaction from the user via a browser.
To use this, you need to install these modules (From PyPI):
pyOpenSSL
@timrichardson
timrichardson / KOUNTA_SAASU_EXPORT
Last active Aug 29, 2015
web-scraping technique to bulk export Kounta daily cash closings to Saasu. Currently there is no public Kounta API.
View KOUNTA_SAASU_EXPORT
There is no API available for Kounta. Well, Kounta says there is one if you ask; I've asked a few times and was ignored.
This is a webscraping solution to mass exporting of daily takings reports into Saasu.
You can’t perform that action at this time.