Skip to content

Instantly share code, notes, and snippets.

View JayGoldberg's full-sized avatar

Jay Goldberg JayGoldberg

  • Google
  • San Francisco, CA, USA
View GitHub Profile
@sdesalas
sdesalas / Async.gs
Last active April 29, 2025 01:24
Asynchronous execution for Google App Scripts (gas)
/*
* Async.gs
*
* Manages asyncronous execution via time-based triggers.
*
* Note that execution normally takes 30-60s due to scheduling of the trigger.
*
* @see https://developers.google.com/apps-script/reference/script/clock-trigger-builder.html
*/
const FfmpegCommand = require('fluent-ffmpeg');
const spawn = require('child_process').spawn;
const path = require('path');
const fs = require('fs-extra');
const Promise = require('bluebird');
const _ = require('lodash');
const del = require('del');
/**
 * @class ThumbnailGenerator
#!/bin/sh
# Add swap space
sudo dphys-swapfile swapoff
sudo sed -r -i "s/(CONF_SWAPSIZE\s*=.*)/#\1/g; s/#((CONF_MAXSWAP\s*=).*)/\24096/g" /etc/dphys-swapfile
sudo dphys-swapfile swapon
# Update Raspberry Pi and schedule auto-updates
sudo apt-get update && sudo apt-get full-upgrade -y && sudo apt-get dist-upgrade -y
sudo apt-get autoremove -y
@Laberbear
Laberbear / ESP8266_Espruino.md
Created November 29, 2019 00:16
Setup Guide for ESP8266 and Espruino

Small Guide to get this thing up and running

1a. WiFi Connection

The board will automatically create a WiFi AP when it is connected: SSID: EspruinoDev PW: EspruinoPW

Connect to this WiFi and the Espruino Board will be the default gateway. Most likely something like 192.168.4.1

@itskenny0
itskenny0 / dogfood.sh
Last active July 24, 2021 16:53
feeding the watchdog on a Raspberry Pi Zero
#!/bin/bash
exec 5>/dev/watchdog # opens file descriptor
upSeconds="$(cat /proc/uptime | grep -o '^[0-9]\+')"
while [ $(cat /proc/uptime | grep -o '^[0-9]\+') -lt 432000 ] ; do
echo "Feeding dog ..."
echo >&5
sleep 10
done
@ross-u
ross-u / README.md
Last active December 21, 2022 03:21
Canvas API - Basics

Canvas | Intro & Basic Drawing


The <canvas> tag

The HTML <canvas> tag serves as a container for canvas graphics.

You must use JavaScript to actually draw the graphics.

@lakshmanok
lakshmanok / etl_geojson.py
Created July 17, 2019 18:19
How to load GeoJSON files to BigQuery
#!/usr/bin/env python3
# See: https://medium.com/@lakshmanok/how-to-load-geojson-files-into-bigquery-gis-9dc009802fb4
import json
with open('NUTS_BN_01M_2016_4326_LEVL_3.geojson', 'r') as ifp:
with open('to_load.json', 'w') as ofp:
features = json.load(ifp)['features']
# new-line-separated JSON
schema = None
for obj in features:
@benjaminadk
benjaminadk / thumbnail-creator.js
Created June 15, 2019 10:38
aws lambda thumbnail/gif creator
process.env.PATH = process.env.PATH + ':' + process.env['LAMBDA_TASK_ROOT']
const AWS = require('aws-sdk')
const { spawn, spawnSync } = require('child_process')
const { createReadStream, createWriteStream } = require('fs')
const { request } = require('http')
const s3 = new AWS.S3()
const ffprobePath = '/opt/nodejs/ffprobe'
const ffmpegPath = '/opt/nodejs/ffmpeg'
@kballenegger
kballenegger / Code.gs
Created February 23, 2019 08:02
gc_distance Google Sheets Script
function _tester() {
Logger.log("New test run…")
var result = gc_distance('sfo', 'jfk');
Logger.log(result)
}
function location_of(airport) {
return data[airport.toUpperCase()];
}
@Alfacat
Alfacat / directlink-download-gdrive-onedrive-dropbox.markdown
Created November 24, 2018 21:29
Directlink download(GDrive, Onedrive, Dropbox)