Skip to content

Instantly share code, notes, and snippets.

Jørgen P. Tjernø jorgenpt

Block or report user

Report or block jorgenpt

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 steam_transaction_totals.js
// To be run on
function parseTotals()
var transactions = document.getElementsByClassName('wallet_table_row');
var totals = { usd: 0, eur: 0 };
for (var i = 0; i < transactions.length; ++i)
var transaction = transactions[i];
var items = transaction.getElementsByClassName('wht_items')[0];
if (items && items.innerText.indexOf('Wallet Credit') >= 0)
jorgenpt / TextProgressBar.cs
Last active Aug 11, 2016
Text based progress bar for C#
View TextProgressBar.cs
using System;
using System.Collections.Generic;
namespace JPT
public class TextProgressBar : IDisposable
private int _progress;
private int _total;
private int _width;
jorgenpt /
Created May 26, 2014
Helper scripts to update & extract the steam-runtime for direct distribution.
#!/bin/bash -e
# Helper script for extracting the steam-runtime that:
# - Strips unused parts of the runtime (documentation)
# - Allows you to extract a single architecture
# - Extracts it to a directory that doesn't contain the runtime date.
function fatal() { echo "$@" >&2; exit 1; }
if [ $# -lt 3 ]; then
fatal "Usage: $0 <steam-runtime path> <amd64|i386|all> <output directory>" >&2
jorgenpt /
Last active Aug 29, 2015
steam-runtime launcher script for use outside of Steam
# Path relative to the directory where the executable lives.
# Figure out where this script lives.
exedir="$(cd "$(dirname "$0")" && pwd)"
# If this script is named `' or `foo', we execute `foo.bin'
exename="$(basename "$0" ".sh").bin"
jorgenpt / SaneMinMaxMacros.h
Last active Jan 11, 2019
An attempt at some saner min-max-clamp macros for C and Objective-C. Require a modern compiler (C11) with support for statement expressions (Gnu11).
View SaneMinMaxMacros.h
#pragma once
#define _CheckTypes(a,b) _Static_assert(_Generic(a, typeof (b):1, default: 0), "Mismatched types")
#define Min(a,b) \
({ \
const typeof (a) _a = (a); \
const typeof (b) _b = (b); \
_CheckTypes(_a,_b); \
(_a < _b ? _a : _b); \

Keybase proof

I hereby claim:

  • I am jorgenpt on github.
  • I am jorgenpt ( on keybase.
  • I have a public key whose fingerprint is C54B EFD5 C4CF 4AEE D568 9A3C CEE2 5916 07D6 4BF0

To claim this, I am signing this object:

jorgenpt /
Last active Sep 14, 2016
Batches multiple invocations of ksdiff to open in a single Kaleidoscope window if they happen within a few seconds of eachother. This is useful for Kaleidoscope integration with P4V, since it makes a multi-file diff open in a single window. If it doesn't quite pick up all your files, try setting TIMEOUT to more than 4 seconds.
# Number of seconds we wait after a file is received before we consider the
# batch to be completed.
# Title of the tab in Kaleidoscope
LABEL="P4V ksdiff-batch"
# FIFO we communicate with the "batch master" for.
View RunHammerwatch
DIR=$(cd "$(dirname "$0")"; pwd)
MONO=`which mono`
if [ ! -z "$MONO" ]; then
TXT=`${MONO} -V`
jorgenpt / HTTPSCertificateRetriever.h
Last active Dec 27, 2015
Utility class to retrieve HTTPS certificates from a server.
View HTTPSCertificateRetriever.h
#import <Foundation/Foundation.h>
@protocol HTTPSCertificateRetrieverDelegate <NSObject>
* Called when we succeed (or fail) to retrieve the certificate.
* @param certificate nil if we fail, otherwise the data of the certificate.
- (void)certificateRetrieved:(NSData*)certificate;
jorgenpt / gist:6589639
Created Sep 17, 2013
Remove the "Command-T" hotkey in Finder, which normally is "Add to Sidebar"
View gist:6589639
defaults write NSUserKeyEquivalents -dict-add "Add to Sidebar" nil
You can’t perform that action at this time.