Skip to content

Instantly share code, notes, and snippets.

@gmale
gmale / WithoutScanning.kt
Last active June 14, 2019 16:19
Handling Reorgs
/*
* Example of handling Reorgs when you don't care about scanning (like lightwalletd). Coroutines and other details have also been removed for simplicity.
*/
fun start() {
do {
// we must increase the number of blocks that we download after each failure in order to handle larger reorgs
retryUpTo(config.retries) {
val result = processNewBlocks()
// immediately process again after failures in order to download new blocks right away
if (result > -1) {
@gmale
gmale / clearAndroidProcessData.md
Last active August 29, 2015 14:04
Android running process utilities.

To use:

git clone https://gist.github.com/d75b0fc8c74b81d9c1a5.git
cd d75b0fc8c74b81d9c1a5

./androidClear <search_text>

# type a number at the prompt to clear an app's data
# warning: this is the same as running "clear data" from the app manager
@gmale
gmale / androidVersions
Last active August 29, 2015 13:57
Just a quick script I whipped together so I can see the latest android stats. Beware: I'm not a Python dev so plz excuse the crappy codez.
#! /usr/bin/env python3
import re
import requests
import json
from datetime import datetime
link = "http://developer.android.com/about/dashboards/index.html"
contents = requests.get(link).text
currentYear = datetime.now().year
@gmale
gmale / fef.sh
Created April 23, 2013 18:56
For Each Folder. For each folder, run a given shell command. I use this to switch some (but not all) submodules to a particular branch. As in: bash$ fef ag-api ag-bizniz ag-data ag-data-commons Folders: ag-api ag-bizniz ag-data ag-data-commons Enter the command you'd like to run in each of these folders: git checkout feature/SID-578-add-timely-s…
#!/bin/bash
folders=$@
echo -e "\nFolders: $folders"
read -p "Enter the command you'd like to run in each of these folders: " commands
echo
for f in $folders
do