Skip to content

Instantly share code, notes, and snippets.

View leifj's full-sized avatar

Leif Johansson leifj

View GitHub Profile
def heapy(trace=False):
def decorating(func):
def new_func(*args, **kwargs):
from gc import collect
collect()
from guppy import hpy
hp = hpy()
before = hp.heap()
r = func(*args, **kwargs)
@leifj
leifj / doi:99.999999:foo-bar-1-2-3
Last active May 29, 2019 09:43
example manifest
{
"@context": ["https://gist.githubusercontent.com/leifj/1cf79d40e977b1330e3b2ebdcafe53da/raw/6d767e781b13d6466f8bce5a816f7ea41a1ed476/metadata-manifest.jsonld", {
"@base": "https://api.example.com/manifest/se-stb-1/b1d6e8d4-6a43-4e10-9961-4544da499914/"
}],
"@id": "",
"manifest": [
{"@id": "some-dublin-core", "schema": "dc:"},{"@id": "my-datacite-object", "schema": "datacite:"}
],
"publisher": "Stockholms Högskola",
{
"@context": {
"metalink": "https://gist.github.com/leifj/1cf79d40e977b1330e3b2ebdcafe53da#",
"dct": "http://purl.org/dc/terms/",
"manifest": { "@id": "metalink:manifest", "@type": "@id" },
"schema": { "@id": "metalink:schema", "@type": "@id" },
"owner": { "@id": "metalink:owner", "@type": "@id" },
"dc": "http://purl.org/dc/elements/1.1",
"datacite": "http://datacite.org/schema/kernel-3",
"publisher": { "@id": "dct:publisher" },
@leifj
leifj / ff_set
Last active January 4, 2023 18:08
A simple cmdline to set firefox config in all profiles found in $HOME/.mozilla/firefox - useful to disable TRR
#!/bin/bash
#
# https://blog.ungleich.ch/en-us/cms/blog/2018/08/04/mozillas-new-dns-resolution-is-dangerous/
# https://askubuntu.com/questions/313483/how-do-i-change-firefoxs-aboutconfig-from-a-shell-script
#
# To completely disable sending your DNS queries to cloudflare:
#
# ff_set network.trr.mode 5
#
#include <stdio.h>
#include <stdlib.h>
#include <winscard.h>
#define CHECK(f, rv) \
if (SCARD_S_SUCCESS != rv) \
{ \
fprintf(stderr, f ": %s\n", pcsc_stringify_error(rv)); \
return -1; \
}
@leifj
leifj / gist:a33bb87cc7e3a1109329
Last active August 29, 2015 14:14
ipnett ca rollover

Keybase proof

I hereby claim:

  • I am leifj on github.
  • I am leifj (https://keybase.io/leifj) on keybase.
  • I have a public key whose fingerprint is 8AA0 9281 A412 FC6B E50A EEE4 D73A D643 0AD4 78D6

To claim this, I am signing this object: