Skip to content

Instantly share code, notes, and snippets.

@dpfrakes
dpfrakes / DTED_tileset.md
Last active March 14, 2024 18:22
Convert DTED to GeoTIFF for Mapbox tileset

Unzip DTED archive. This should contain one inner directory for every longitudinal band (e.g. w077).

Run the following script to convert to 8-bit GeoTIFF. Mapbox tilesets only support 8-bit.

# Convert all dt0 to GeoTIFF
for file in ../dtedlevel0/**/*.dt0; do
    output_file="./$(basename "$file" .dt0).tif"
    gdal_translate -of GTiff -ot Byte "$file" "$output_file"
done
const fs = require('fs');
const readline = require('readline');
const moment = require('moment-timezone');
readline.emitKeypressEvents(process.stdin);
process.stdin.setRawMode(true);
process.stdin.on('keypress', (str, key) => {
if (key.ctrl && key.name === 'c') {
process.exit();
} else {
@dpfrakes
dpfrakes / guide.md
Last active February 26, 2020 22:01
Python 2 and 3 on Mac

Python on Mac

Feb. 2020


DO NOT DELETE ANYTHING IN /System/Library/Frameworks/Python.framework/


Clean

@dpfrakes
dpfrakes / find_in_dict.py
Created October 15, 2019 16:37
Find key or value recursively in python dict
def find_k(data, target, spec=0):
result = ''
found = False
for k, v in data.items():
print(f'{"\t" * spec}{k}: {type(v)}')
if isinstance(v, dict):
search, found = find_k(v, target, spec+1)
result = f'{k} > {search}'
elif k == target:
found = True
a {
background: linear-gradient(90deg, blue 100%, blue 0);
background-position: center 85%;
background-size: 0 2px;
background-repeat: no-repeat;
transition: color 200ms ease-in-out, background 200ms linear;
padding-bottom: 0.5rem;
}
a:hover {
background-size: 100% 2px;

Kali Linux

Set up Kali Linux on Raspberry Pi 3

  1. Download Kali Linux image (for Raspberry Pi)
  2. Insert micro SD card
  3. Open [Disk Utility](/Applications/Utilities/Disk\ Utility.app)
  4. Erase and format as MS-DOS (FAT)

From the command line:

Keybase proof

I hereby claim:

  • I am dpfrakes on github.
  • I am dpfrakes (https://keybase.io/dpfrakes) on keybase.
  • I have a public key ASCE8olUpYws_jv2idRkQYxAouurKIe9t0GdgcZavmxsjAo

To claim this, I am signing this object:

@dpfrakes
dpfrakes / run_speedtest.py
Created March 8, 2019 06:35
Run speedtest and upload results to AWS DynamoDB
import boto3
import speedtest
from decimal import Decimal
# Initialize variables
s = speedtest.Speedtest()
s.get_best_server()
# Run tests
s.download()
@dpfrakes
dpfrakes / multithread.py
Created October 11, 2018 11:18
Simple multithreading implementation
"""
https://stackoverflow.com/questions/2846653/how-to-use-threading-in-python
https://stackoverflow.com/questions/5442910/python-multiprocessing-pool-map-for-multiple-arguments/5443941#5443941
"""
import itertools
from multiprocessing import Pool
def _func_run_task(x):
return do_task(*x)
@dpfrakes
dpfrakes / sublime_indentation.md
Last active August 30, 2018 17:54
Debugging sublime indentation

Sublime indentation

  1. Sublime Text > Preferences > Settings : "translate_tabs_to_spaces": [true|false]
  2. Sublime Text > Preferences > Settings - Syntax Specific : "translate_tabs_to_spaces": [true|false]
  3. View > Indentation > Indent using spaces : toggle
  4. Open .editorconfig if it exists : update indent_style = [space|tab|ignore]