Skip to content

Instantly share code, notes, and snippets.

View therefromhere's full-sized avatar

John Carter therefromhere

  • Auckland, New Zealand
View GitHub Profile
@therefromhere
therefromhere / djstripe_fixture_regeneration.patch
Last active June 8, 2019 03:09
Example changes when regenerating fixtures
diff --git a/tests/fixtures/balance_transaction_txn_fake_ch_fakefakefakefakefake0001.json b/tests/fixtures/balance_transaction_txn_fake_ch_fakefakefakefakefake0001.json
index edc7069..7e288ed 100644
--- a/tests/fixtures/balance_transaction_txn_fake_ch_fakefakefakefakefake0001.json
+++ b/tests/fixtures/balance_transaction_txn_fake_ch_fakefakefakefakefake0001.json
@@ -5,7 +5,7 @@
"available_on": 1558569600,
"created": 1557995177,
"currency": "usd",
- "description": "Payment for invoice 3D77FB04-0001",
+ "description": "Payment for invoice 8898D96E-0001",
@therefromhere
therefromhere / firestore_emulator.py
Last active January 17, 2022 19:45
OBSOLETE, see comment below ||| Connection to the Firestore emulator in python, since it wasn't at that time supported by the official SDK, see https://github.com/googleapis/google-cloud-python/issues/7500
import os
from unittest import mock
import grpc
from google.auth.credentials import Credentials
from google.cloud import firestore
from google.cloud.firestore_v1.gapic import firestore_client
from google.cloud.firestore_v1.gapic.transports import firestore_grpc_transport
BEGIN;
--
-- Alter field display_name on account
--
--
-- Alter field support_email on account
--
--
-- Alter field support_phone on account
--

Keybase proof

I hereby claim:

  • I am therefromhere on github.
  • I am therefromhere (https://keybase.io/therefromhere) on keybase.
  • I have a public key ASBdEJLz_yc2k6Oxs1NXEe0G9ASb8P3Qu9spNLS7famV5go

To claim this, I am signing this object:

@therefromhere
therefromhere / multi_plan.json
Last active December 8, 2018 21:05
Example stripe invoice_created webhook events with single and multiple plans
{
"id": "evt_1Deux4KatMEEd998YDZ5pF4a",
"object": "event",
"api_version": "2018-11-08",
"created": 1544233793,
"data": {
"object": {
"id": "in_1Deux2KatMEEd9980pjPFUWj",
"object": "invoice",
"amount_due": 300,
@therefromhere
therefromhere / csp-report-schema.json
Created October 16, 2016 02:50
Content Security Policy Violation Report syntax as JSON schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Content Security Policy Violation Report",
"type": "object",
"required": [ "csp-report" ],
"properties": {
"csp-report": {
"type": "object",
"properties": {
"document-uri": { "type": "string" },

Python virtualenv path gotcha

sudo apt-get install python-pip; pip install virtualenv; pip install virtualenvwrapper

The above works fine (note that you don't need to sudo the pip stuff, it gets installed in ~/.local) but ~/.local isn't in $PATH by default, so virtualenvwrapper.sh isn't pathed in.

One fix is to using the default ~/.profile behaviour to path ~/bin if it exists:

ln -s ~/.local/bin ~/bin

#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.