Skip to content

Instantly share code, notes, and snippets.

Mikhail Furlender mfurlend

View GitHub Profile
View csv_to_shp.sh
ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3857 -oo X_POSSIBLE_NAMES='LON*' -oo Y_POSSIBLE_NAMES='LAT*' -f "ESRI Shapefile" out.shp ghcn.csv
@mfurlend
mfurlend / georeference_and_crop_example.sh
Created May 29, 2019
georeference and crop an image
View georeference_and_crop_example.sh
gdal_translate -of GTiff -a_ullr ullon ullat lrlon lrlat -a_srs EPSG:4269 input.tif output.tif
gdal_translate -of GTiff -a_ullr -134.09548 52.640547 -60.90728 21.14054 -a_srs EPSG:102009 ~/Desktop/example_image.png output.tif
gdalwarp -t_srs EPSG:4326 -te ullon ullat lrlon lrlat -ts width_px height_px input.tif output.tif
gdalwarp -t_srs EPSG:102009 -te -100 30 -80 40 -ts 920 768 output.tif output2.tif
@mfurlend
mfurlend / gcp.sh
Created Jan 16, 2019
Fast google cloud VM ssh sessions
View gcp.sh
gcp () {
local inp1 inp2
inp1=$1
inp2=$2
DEFAULT_USER=SOME_USER
if (( ! $# ))
then
inp1="-h"
fi
if [[ $inp1 == "-h" || $inp1 == "--help" ]]
@mfurlend
mfurlend / goo.sh
Created Jan 16, 2019
Fast google cloud profile switching/listing
View goo.sh
goo () {
local inp1 inp2
inp1=$1
inp2=$2
if (( ! $# ))
then
inp1="-h"
fi
if [[ $inp1 == "-h" || $inp1 == "--help" ]]
then
@mfurlend
mfurlend / eachhost.sh
Last active Jan 7, 2019
run command on each host
View eachhost.sh
# run command on each host in /etc/hosts and print the output
# stop on failure (remove || break to continue on failure)
# use a pretty line break to delimit responses
# like this:
#┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫hostname┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
eachhost () {
# ignore line 1 and 5 in /etc/hosts
for host in $(sed 1,5d /etc/hosts|awk '{print $2}')
do
(
@mfurlend
mfurlend / webtorrent-desktop-batch-delete.js
Created Oct 4, 2018
webtorrent-desktop batch delete scripts
View webtorrent-desktop-batch-delete.js
//Delete all
let delete_buttons = Array.from(document.getElementsByClassName('delete'))
while (delete_buttons.length > 0) {
let button = delete_buttons.pop();
button.click();
Array.from(document.querySelector('.control.ok').getElementsByTagName('*')).forEach(o=>o.click());
}
// Delete paused
@mfurlend
mfurlend / nfs_shares_with_subdirectories.md
Last active Jun 8, 2018
Export/Import NFS shares with subdirectories as mount points
View nfs_shares_with_subdirectories.md
/etc/exports (on NFS server)
/mnt/disk                     10.142.0.0/24(rw,no_subtree_check,sync,crossmnt)
/mnt/disk/WRFV381/data_ingest 10.142.0.0/24(rw,no_subtree_check,sync)
/etc/auto.hvm (on NFS client, with AutoFS)
/mnt/disk                     -rw,soft,intr,rsize=8192,wsize=8192,nosuid    10.142.0.12:/mnt/disk
/mnt/disk/WRFV381/data_ingest -rw,soft,intr,rsize=8192,wsize=8192,nosuid    10.142.0.12:/mnt/disk/WRFV381/data_ingest
@mfurlend
mfurlend / delete_all_torrents_in_webtorrent.js
Created May 14, 2018
delete all torrents in WebTorrent
View delete_all_torrents_in_webtorrent.js
var delete_buttons = Array.from(document.getElementsByClassName('delete'))
while (delete_buttons.length > 0) {
var button = delete_buttons.pop();
button.click();
Array.from(document.querySelector('.control.ok').getElementsByTagName('*')).forEach(o=>o.click());
}
@mfurlend
mfurlend / save-to-datastore-index.js
Created Feb 6, 2018
#google #datastore #save #cloud functions
View save-to-datastore-index.js
exports.transaction = function transaction (req, res) {
// Imports the Google Cloud client library
const Datastore = require('@google-cloud/datastore');
// Your Google Cloud Platform project ID
const projectId = 'moneypenny-dabc6';
// Instantiates a client
const datastore = Datastore({
projectId: projectId
View datastore-query-by-multiple-properties.js
const query = datastore
.createQuery('Task')
.filter('done', '=', false)
.filter('priority', '=', 4);
You can’t perform that action at this time.