Skip to content

Instantly share code, notes, and snippets.

Avatar

Dominique Bischof dbischof

View GitHub Profile
@dbischof
dbischof / postman-oauth2-refresh-token.js
Last active Nov 14, 2018 — forked from harryi3t/postman-oauth2-refresh-token.js
This gist shows how using the pre-request script in Postman, a new Oauth-2 token can be obtained using the a refresh token
View postman-oauth2-refresh-token.js
/**
** Inspired by: https://stackoverflow.com/a/52436395/1756953
** Modified from: https://gist.github.com/harryi3t/dd5c61451206047db70710ff6174c3c1
**
** Postman as of Nov 2018 does not support auto-refreshing of Oauth-2 tokens.
** This is an exmaple on how in one can refresh their Oauth-2 tokens just using the pre-request scripts.
** Pre-requisites: You need to have a refresh token. You can use the Postman app to get one.
**
** Step 1: Create a Postman environment and set the following variables:
** tokenUrl
@dbischof
dbischof / stripe_projections.py
Created Aug 29, 2017
Projects/forecasts upcoming Stripe subscription payments (grouped by payment day)
View stripe_projections.py
import collections, stripe
from datetime import datetime
stripe.api_key = ''
print "Stripe subscription forecast"
last_obj = None
paydays = {}
loop = 0
@dbischof
dbischof / qbo-bulk-class-bookmarklet.js
Last active Jun 11, 2017
Set QBO class fields in bulk
View qbo-bulk-class-bookmarklet.js
javascript: (function () {
var jsCode = document.createElement('script');
jsCode.setAttribute('src', 'https://rawgit.com/dbischof/fb85f76d589123020359e96fce5c5e40/raw/115a2c0667f9c02a90fc7a1226fb09e08bea96a9/qbo-bulk-class.js');
document.body.appendChild(jsCode);
}());
@dbischof
dbischof / tradegecko-new-purchase-order-date.user.js
Last active Mar 25, 2017
Userscript to set stock due date on new TradeGecko purchase orders to current date
View tradegecko-new-purchase-order-date.user.js
// ==UserScript==
// @name TG PO Stock Due Changer
// @description Set stock due date on new TradeGecko purchase orders to current date
// @match https://go.tradegecko.com/*
// @version 0.2
// ==/UserScript==
var targetPage = '/purchase_orders/new';
var currentPage = window.location.pathname;
if (currentPage == targetPage) {
@dbischof
dbischof / CorrectPicturesinWrongDateFolder.sh
Created Nov 9, 2015
Script to fix Picasa iOS9 date import bug
View CorrectPicturesinWrongDateFolder.sh
#!/bin/bash
echo Finding all pictures in the wrong folder
CURDIR=$(pwd)
cd /PATH/TO/PICTURES
for FOLDER in $(find . -type d -mtime -2 -name "*-*"); do
cd $FOLDER
View keybase.md

Keybase proof

I hereby claim:

  • I am dbischof on github.
  • I am dominique (https://keybase.io/dominique) on keybase.
  • I have a public key whose fingerprint is 9D9E 5F44 B556 808D 4D1D 5A26 58F1 B3D2 5581 C0AC

To claim this, I am signing this object:

@dbischof
dbischof / gist:8060934
Created Dec 20, 2013
Running custom Mezzanine code through Fabric (for more complex/production code use a Django management command).
View gist:8060934
# Two Fabric related items that tripped me up:
#
# 1. For most complex code, you have to prepend your code string with code=, as in fab python:code="[Your code]".
# Not doing this will result in the following error:
# TypeError: python() got an unexpected keyword argument '[the first few chars of your code...]'
#
# 2. If you have an = in your code, it must be escaped. Not escaping them will result in the following error:
# ValueError: too many values to unpack
#
# Here's a short sample:
@dbischof
dbischof / gist:8060782
Created Dec 20, 2013
Send django email from the command line
View gist:8060782
### %> python manage.py shell
import settings
from django.core.mail import send_mail
send_mail('This is the subject', 'Here is the message.', settings.EMAIL_HOST_USER, ['recipient@example.com'], fail_silently=False)
# or
import settings
You can’t perform that action at this time.