Skip to content

Instantly share code, notes, and snippets.

View JayGoldberg's full-sized avatar

Jay Goldberg JayGoldberg

View GitHub Profile
@JayGoldberg
JayGoldberg / etl_geojson.py
Last active September 17, 2023 19:37 — forked from lakshmanok/etl_geojson.py
How to load GeoJSON files to BigQuery (supports filename arg)
#!/usr/bin/env python3
# See: https://medium.com/@lakshmanok/how-to-load-geojson-files-into-bigquery-gis-9dc009802fb4
import json
import sys
def convert_geojson(input_file_path):
with open(input_file_path, 'r') as ifp:
with open('to_load.json', 'w') as ofp:
features = json.load(ifp)['features']
@JayGoldberg
JayGoldberg / mouseDraw.js
Last active December 21, 2022 03:17 — forked from brettbartylla/mouseDraw.js
This javascript allows a mouse to draw on an HTML5 Canvas
// Get the canvas and its context
var canvas = document.querySelector('#paint');
var ctx = canvas.getContext('2d');
// Get the parent element of the canvas and its computed style
var sketch = document.querySelector('.sketch');
var sketch_style = getComputedStyle(sketch);
// Set the canvas dimensions to match the parent element
canvas.width = parseInt(sketch_style.getPropertyValue('width'));
@JayGoldberg
JayGoldberg / drawing.js
Created December 21, 2022 03:15 — forked from zachdunn/drawing.js
Canvas mouse drawing for a canvas #sketch plus button #clear.
(function(window){
// Define the Pen object, which handles drawing on the canvas
var Pen = function(context){
// Whether the user is currently drawing
var drawing;
// Reset the pen's drawing style
this.reset = function(){
context.beginPath();
context.lineCap = 'round';
@JayGoldberg
JayGoldberg / ftp_sync.sh
Last active July 25, 2021 12:55 — forked from guerrerocarlos/copy_to_ftp.sh
Script for syncing OUCAM camera videos automatically to FTP
#!/bin/sh
# FTP_COPY version 0.3 by MP77V www.4pda.ru
# ----------------------------
FTP_DEST_DIR="/FTP_directory"
FTP_DEST_HOST="FTP_host"
FTP_DEST_PORT="21"
FTP_DEST_LOGIN="FTP_user"
FTP_DEST_PASS="FTP_password"
# ----------------------------
@JayGoldberg
JayGoldberg / ispperf.sh
Last active March 8, 2019 19:40 — forked from ianrust/ispperf.sh
Script for logging and monitoring isp ping, latency, and bandwidth. Borrowed from here: https://www.blackhatworld.com/seo/bash-script-to-check-isp-bandwidth-and-latency.257820/
#!/bin/bash
# The MIT License
#
# Copyright (c) 2010, MaDeuce
#
# https://en.wikipedia.org/wiki/MIT_License
#
# ============================================================================
# This command measures latency and bandwidth of an internet connection from the command line.
@JayGoldberg
JayGoldberg / uri.sh
Last active May 8, 2017 20:01 — forked from yock/uri.sh
URL Parsing function for Bash
#
# URI parsing function
#
# The function creates global variables with the parsed results.
# uri_schema, uri_address, uri_user, uri_password, uri_host, uri_port, uri_path, uri_query, uri_fragment
# It returns 0 if parsing was successful or non-zero otherwise.
#
# [schema://][user[:password]@]host[:port][/path][?[arg1=val1]...][#fragment]
#
function uri_parser() {
#!/bin/bash
## @author Jay Goldberg
## @email jaymgoldberg@gmail.com
## @license Apache 2.0
## @description Run web browser in a cgroup
## @usage cgroup-chrome
#=======================================================================
MB=${$1:-1024}
@JayGoldberg
JayGoldberg / mgoExample.go
Created April 11, 2016 15:32 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {