Skip to content

Instantly share code, notes, and snippets.

@mohoff
mohoff / subprovider-setup.js
Last active June 8, 2018 15:28
Template to setup subproviders and Web3
const MnemonicWalletSubprovider = require('@0xproject/subproviders').MnemonicWalletSubprovider
const RPCSubprovider = require('web3-provider-engine/subproviders/rpc')
const Web3ProviderEngine = require('web3-provider-engine')
const Web3Wrapper = require('@0xproject/web3-wrapper').Web3Wrapper
const Web3 = require('web3')
const fs = require('fs')
const NETWORK_ID = 1
const INFURA_API_KEY = '<INFURA_API_KEY>'
const MNEMONIC = fs.readFileSync('./mnemonic.txt', 'utf8')
@mohoff
mohoff / buildAndViewLatexPDF.sh
Created December 20, 2015 15:48
Bash script that build .tex and .bib input and outputs the pdf file along other latex output files that are moved into a subdirectory. Checks for 'texlive'- and related packages. Shows resulting pdf with standard pdf viewer using 'gnome-open'. Works on Ubuntu 15.04.
#!/bin/bash
#################################################
# Script to build latex and bibtex files to pdf #
#################################################
# Check for one input parameter specifying file or filename of .tex and .bib file.
if [ $# -eq 0 ]
then
echo "ERROR: Please provide input file or filename as parameter"
@mohoff
mohoff / viewAndroidDB.sh
Last active August 29, 2015 14:27
Script to pull a database file from an Android phone and open it with sqlitebrowser on Ubuntu. Phone needs to be rooted. Edit default filename and packagename as needed. Check if tools sqlitebrowser and adb are installed (latter should be able to connect to your phone). Not sure if it also works with an emulator.
#!/bin/sh
set -e
filename="database.db"
packagename="de.mohoff.zeiterfassung"
if [ "$#" -eq 2 ]
then
filename="$1"
packagename="$2"
fi
adb shell "su -c 'chmod 777 /data /data/data /data/data/$packagename /data/data/$packagename/databases /data/data/$packagename/databases/$filename;