Skip to content

Instantly share code, notes, and snippets.

View dokterbob's full-sized avatar

Mathijs de Bruin dokterbob

View GitHub Profile
@dokterbob
dokterbob / ipfs-robust-add.sh
Last active September 15, 2023 12:18
Add arbitrarily large directory structures to IPFS, without running into OOM kills, failure at 99% etc.
#!/bin/sh
set -e # Enable errexit option
### Adding arbitrarily large directory structures to IPFS, without running into OOM kills, failure at 99% etc.
### Results in directory with same name in MFS, use `ipfs files ls` to see it.
### Uses Blake2B for faster hashing and maximum block size, assuming large fiels with lower needs for searching.
### Uses filestore as not to duplicate data (make sure to enable it in the ipfs config!).
# Create directory structure in MFS
@dokterbob
dokterbob / avalanchego_on_smartos.md
Created March 26, 2021 14:57
Building avalanchego on SmartOS
@dokterbob
dokterbob / build.sh
Last active May 24, 2019 20:26
SAGA 7.2 build on macOS Mojave 10.14.5
#!/bin/sh
./configure \
--with-gdal=/Library/Frameworks/GDAL.framework/Versions/2.4/unix/bin/gdal-config \
--disable-odbc \
CXXFLAGS="-std=gnu++11" \
CPPFLAGS="-I/Library/Frameworks/PROJ.framework/Headers" \
LDFLAGS="-L/Library/Frameworks/PROJ.framework/unix/lib"
make -j8
@dokterbob
dokterbob / install-pip.sh
Created January 13, 2017 16:40
Install PIP on OS X, solves Library not loaded: @loader_path/../lib/libssl.1.0.0.dylib
$ pip install psycopg2 --no-binary :all:
@dokterbob
dokterbob / install-pip.sh
Created January 13, 2017 16:40
Install PIP on OS X
$ pip install psycopg2 --no-binary :all:
@dokterbob
dokterbob / whitelist_playstore.js
Last active January 31, 2017 13:41
Exclude all devices from play store (whitelisting)
// To be executed from Chrome console when selecting excluded devices, excludes all options by default
var checkboxes = document.getElementsByTagName('checkbox');
for (var i=0; i< checkboxes.length; i++) {
var checked = checkboxes[i].getAttribute('aria-checked');
if (checked != "true") {
checkboxes[i].click();
}
}
@dokterbob
dokterbob / dashlane-pass-import.py
Created April 28, 2015 09:46
Python 3 script to import passwords from Dashlane CSV-export
# Import passwords from Dashlane's CSV-export into pass
# Note: you might need to manually clean up the typically malformatted Dashlane CSV export
import sys
import csv
import argparse
import subprocess
def main(argv=None):
@dokterbob
dokterbob / open_csv.py
Created November 10, 2014 18:43
Python dialect-sniffing CSV reader example.
import csv
sniff_range = 4096
delimiters = ';\t,'
infile_name = 'blabla.csv'
sniffer = csv.Sniffer()
print 'Reading file: %s' % infile_name
@dokterbob
dokterbob / rst2browser.py
Created September 4, 2013 13:18
Render reStructuredText straight to the browser.
#!/usr/bin/env python
import sys
import argparse
import tempfile
import webbrowser
import time
from docutils.core import publish_string
import locale
@dokterbob
dokterbob / README.rst
Last active August 13, 2018 00:47
Setting up a Mac system for Python.
  1. Install XCode from the App Store.

  2. Install the XCode command line tools from the 'Downloads' pane in the XCode settings.

  3. Install SublimeText.

  4. Add the following SublimeText configuration options (to User settings):

    // Set to true to insert spaces when tab is pressed
    "translate_tabs_to_spaces": true,