Skip to content

Instantly share code, notes, and snippets.

View gmaclennan's full-sized avatar

Gregor MacLennan gmaclennan

View GitHub Profile
@gmaclennan
gmaclennan / adb-wrapper.sh
Created September 19, 2024 09:59 — forked from c3ph3us/adb-wrapper.sh
A useful shell script that wraps Android adb commands when multiple devices or emulators are connected. The script will prompt for a device or emulator to run the command against, if it detects multiple devices / emulators.
#!/bin/bash
# This is a wrapper for adb. If there are multiple devices / emulators, this script will prompt for which device to use
# Then it'll pass whatever commands to that specific device or emulator.
# Run adb devices once, in event adb hasn't been started yet
BLAH=$(adb devices)
# Grab the IDs of all the connected devices / emulators
IDS=($(adb devices | sed '1,1d' | sed '$d' | cut -f 1 | sort))
@gmaclennan
gmaclennan / machine.js
Last active February 21, 2020 12:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@gmaclennan
gmaclennan / DISCUSSION.md
Created August 7, 2018 23:16
Ideas for a file format for mapeo sync

Problem

We want to be able to synchronize the data in mapeo-core to disk so that it can be transported via "sneakernet" to another device. This would most likely be on a USB flash drive, but could also be sent over email or a local bluetooth connection.

Currently safe-fs-blob-store - an implementation of abstract-blob-store - is used for storing media (attachments) in the mapeo-core database. On disk the blobs as stored as files and folders. This is potentially a problem for moving the archive around on disk because a user could easily, accidentally or intentionally, move files and folders and result in data loss and a corrupt database.

Requirements

Ideally we would have a single file containing all attachments and all database data that can be used to sync between machines.

@gmaclennan
gmaclennan / example.js
Last active April 26, 2018 17:06
Adding layers to react-mapfilter
var LayerControl = require('@digidem/mapbox-layer-control')
var layerControl
var myControl = {
onAdd: function (map) {
var style = map.getStyle()
var layers = getLayersFromStyle(style)
layerControl = new LayerControl(layers)
return layerControl.onAdd(map)
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@gmaclennan
gmaclennan / INSTALL.md
Last active February 16, 2018 17:08
Setup of OpenDroneMap Intel NUC for drone image processing

Ubuntu 16.04 Desktop Setup

First things first:

sudo apt update
sudo apt upgrade

Networking Tools

@gmaclennan
gmaclennan / location.geojson
Created January 5, 2018 05:29
Andalucia p2p hack April 2018
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gmaclennan
gmaclennan / map-tiles.md
Last active October 6, 2021 06:00
Ideas for an alternative to mbtiles for map tile storage

MBTiles (MapBox Tiles)

https://github.com/mapbox/mbtiles-spec

MBTiles is a specification for storing tiled map data in SQLite databases for immediate usage and for transfer.

MBTiles is a useful format for storing image and vector tilesets (used in "slippy-maps") on disk, and for transferring between devices for offline use.

MBTiles advantages

@gmaclennan
gmaclennan / guyana-volunteer-wifi.md
Last active July 4, 2018 18:43
Long-distance solar-powered wifi in the forests and savannahs of Guyana

Overview

Digital Democracy is looking for a volunteer to help pilot long-distance solar-powered wifi antennaes in indigenous communities in Guyana.

Background

Digital Democracy is working with the Wapichan people in the South Rupununi in Guyana to support them in efforts to secure their ancestral territory and increase their autonomy and self-determination. The Wapichan live in 17 villages and 7 smaller "satellites" in a large semi-natural savannah ecosystem surrounded by tropical forest. Communication between villages and with the outside world is difficult due to limited or no cellphone or internet access. We want to help the Wapichan improve their means of communicating with the rest of the world and communicating and coordinating between villages.

Location

@gmaclennan
gmaclennan / client.js
Last active July 3, 2017 19:17
Hyperlog http replicate test
const request = require('request')
const duplexify = require('duplexify')
const hyperlog = require('hyperlog')
const memdb = require('memdb')
const log = hyperlog(memdb())
const url = 'http://localhost:4001/'
log.add(null, 'hello', function (err, node) {
if (err) throw err