Skip to content

Instantly share code, notes, and snippets.

View pellepim's full-sized avatar

Jon Nylander pellepim

View GitHub Profile
@pellepim
pellepim / gist:d9ec59b854e77c70fb2663d361a67e01
Created June 6, 2022 15:08
Pretty print author's git log to JSON
git log --author="AUTHOR"\
--pretty=format:'{"commit": "%H", "author": "%aN <%aE>", "date": "%ai", "message": """%B""", "notes": """%N""" },' \
$@ | awk 'BEGIN { print("[") } { print($0) } END { print("]") }' | \
python -u -c 'import ast,json,sys; fp = open("gitlog.json", "w"); \
fp.write(json.dumps(ast.literal_eval(sys.stdin.read()), indent=2, sort_keys=True)); fp.close()'
#!/usr/bin/env python
import requests
from requests_oauthlib import OAuth1 as OAuth
import urllib
import json
CLIENT_KEY = u'REDACTED'
CLIENT_SECRET = u'REDACTED'
BASE_URL = u'https://api.projectplace.com/'
@pellepim
pellepim / wurst.js
Created October 25, 2018 11:50
Körvkörven
(function () {
var searchpattern1 = /budget/;
var searchpattern2 = /kris/;
var replacepattern = "körv";
var searchpattern3 = /regering/;
var replacepattern2 = "curry-wurst";
function replaceText(node) {
var current = node.nodeValue;
var replaced = current.replace(searchpattern1, replacepattern);

Keybase proof

I hereby claim:

  • I am pellepim on github.
  • I am pellepim (https://keybase.io/pellepim) on keybase.
  • I have a public key whose fingerprint is DA29 9F42 95E3 4DC3 B457 27A5 249C FC68 579E FF44

To claim this, I am signing this object:

@pellepim
pellepim / gist:7903cc732dfb8eedaa37
Created October 8, 2015 07:23
project-properties
{
membership_type: "owner",
archived: false,
description: "",
limits: {
boards: {
used: 2,
limit: 2
},
members: {
@pellepim
pellepim / gist:fc7985d8bbdf5c8ea290
Last active October 6, 2015 10:54
log of session 1 and session 2
10/06/2015 11:13:40 AM Session1: Refreshing token randomly, just to screw things up
10/06/2015 11:13:40 AM Starting new HTTPS connection (1): api.projectplace.com
10/06/2015 11:13:40 AM Session1: Refreshing token worked, new access token: {u'token_type': u'Bearer', u'access_token': u'98b30fbba402629916b3a0f1c6b1d190', u'expires': 86400, u'refresh_token': u'e58e10439a0b6ca23268'}
10/06/2015 11:13:40 AM Session1: 200 OK Successfully fetched profile belonging to Keno Granger (v-kengra@microsoft.com)
10/06/2015 11:13:45 AM Starting new HTTPS connection (1): api.projectplace.com
10/06/2015 11:13:46 AM Session1: Calling with token 98b30fbba402629916b3a0f1c6b1d190
10/06/2015 11:13:46 AM Session1: 200 OK Successfully fetched profile belonging to Keno Granger (v-kengra@microsoft.com)
10/06/2015 11:13:46 AM starting session with name Session2
10/06/2015 11:13:51 AM Session1: Calling with token 98b30fbba402629916b3a0f1c6b1d190
10/06/2015 11:13:51 AM Session1: 200 OK Successfully fetched profile belonging to Keno Grang
@pellepim
pellepim / oauth2client.py
Created October 6, 2015 10:10
>>> python oauth2client.py sessionName
from requests_oauthlib import OAuth2Session
import webbrowser
from time import sleep
import requests
from random import randint
import logging
import sys
logging.basicConfig(filename='oauth2.log', level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
LOCAL_REPO_ABSOLUTE_PATH="/Users/jonn/code/main_service"
MOUNT_ABSOLUTE_PATH="/Volumes/pw-next/jon"
while true
do
sleep 1
CHANGED_FILES=( $(find "$LOCAL_REPO_ABSOLUTE_PATH" -type f -ctime -5m -not -path '*/.*'))
for i in "${CHANGED_FILES[@]}"
do
FILE_PATH=${i#*"$LOCAL_REPO_ABSOLUTE_PATH"}
(function () {
var words = ['President Donald J. Trump', 'President Donald Trump', 'President Trump', 'Donald John Trump',
'Donald J. Trump', 'Donald Trump', 'Mr. Trump', 'Trump'];
var replace_with = ['The Kwisatz Haderach', 'The God Emperor', 'The Tango Faced Twatnacker',
'The Peerless Abortion of Good Taste', 'Der Furher',
'The Knight of the Abyss', 'Myrna Minkoff\'s Horny Uncle',
'The Glorious Leader and Saviour of Western Civilisation',
'His Abhorrent Saltiness'];
var replacepatterns = [];
@pellepim
pellepim / apiconnection.py
Last active June 17, 2017 16:45
Projectplace Python API connection wrapper
# -*- coding: utf-8 -*-
"""
Example Usage:
>>> from apiconnection import ApiConnection
>>> settings = {
... 'api_endpoint': 'https://api.projectplace.com',
... 'consumer_key': 'REDACTED',
... 'consumer_secret': 'REDACTED'}