Skip to content

Instantly share code, notes, and snippets.

View lg's full-sized avatar

Larry Gadea lg

View GitHub Profile
@lg
lg / skaffold.yaml
Created July 23, 2022 16:18
Skaffold multi-platform / multi-architecture builds using docker + buildx and a custom buildCommand
apiVersion: skaffold/v2beta28
kind: Config
metadata:
name: abcdef
build:
artifacts:
- image: ghcr.io/lg/abcdef
custom:
buildCommand: | # build for multiple platforms
if ! docker buildx inspect skaffold-builder >/dev/null 2>&1; then docker buildx create --name skaffold-builder --platform $PLATFORMS; fi
@lg
lg / esbuild.ts
Created July 3, 2022 20:47
use ESBuild to bundle and transpile typescript files to javascript
import * as esbuild from "esbuild-wasm"
import esbuildWasmUrl from "esbuild-wasm/esbuild.wasm?url"
import Path from "path"
let isEsbuildWasmInitialized = false
export const tsToJs = async (tree: Record<string, string>) => {
if (!isEsbuildWasmInitialized) {
await esbuild.initialize({ wasmURL: esbuildWasmUrl })
isEsbuildWasmInitialized = true
@lg
lg / update-cloudflare-v4-ip.sh
Created December 4, 2016 23:18
Update router IP address on CloudFlare using their v4 API
#!/bin/sh
#
# cloudflare v4 ip updater for edgerouter
#
# this uses the v4 api which ddclient doesn't support directly. though v1 api of cloudflare is still active, we've disabled it (for SAML support), so v4 is mandatory.
# updating the ip of a hostname is a 3 step process:
#
# 1. get the list of zones:
# curl -X GET "https://api.cloudflare.com/client/v4/zones" -H 'X-Auth-Email: ***CLOUDFLARE-EMAIL***' -H 'X-Auth-Key: ***CLOUDFLARE-TOKEN***' -H 'Content-Type: application/json'
# 2. get the DNS records in a zone (by the id returned above)
@lg
lg / cloudy-gamer-launcher.sh
Last active April 28, 2021 14:25
Easily start/stop Paperspace and Parsec instances
#!/bin/bash
#
# CloudyGamerLauncher by Larry Gadea
# Easily start/stop Paperspace and Parsec instances
#
# Make sure to fill out the variables below. For the machine id, use the
# 8-letter identifier for the machine on Paperspace (ex. PS8RGDUY)
#
# Note: Requires Paperspace API key (generate one in account settings)
@lg
lg / build_tvvlckit.sh
Last active April 5, 2020 15:48
Building MobileVLCKit for AppleTV: TVVLCKit
# note these instructions are as of Dec 28, 2015
# the vlc and vlckit repos are super complex and have thousands of dependencies from everywhere on the internet.
# so, you'll need to mess with things a bit
git clone http://code.videolan.org/videolan/VLCKit.git
cd VLCKit
./buildMobileVLCKit.sh -t
@lg
lg / sonoff4chpror2.json
Created February 17, 2020 15:17
Sonoff 4ch Pro R2 JSON config (uses 3 seconds inching mode for all channels)
{
  "c": {
    "l": 13,
    "i": 0,
    "o": 1,
    "b": [
      {
        "g": 0,
        "t": 5
      }
@lg
lg / cloudygamer.psm1
Last active June 9, 2019 23:18
CloudyGamer initialization script (run manually up to each ###### line)
# CloudyGamer
#
# CURRENTLY WRITTEN FOR PAPERSPACE (see link above for additional azure/aws items)
# based off of: https://github.com/lg/cloudy-gamer/blob/master/cloudygamer.psm1
#
# troubleshooting:
# 1. latency spikes:
# - if hooked up to an external monitor, disconnect
# - if on wifi, try wired
# - if wired and on a fancy switch, turn on/off congestion control on the port
@lg
lg / currentline.psm1
Created June 9, 2019 04:14
current line in script
$tocontinue = $MyInvocation.MyCommand.ScriptBlock.ToString().split([Environment]::NewLine)[(Get-PSCallStack).Position.StartLineNumber,-1] -join [Environment]::NewLine | Out-String
@lg
lg / test.css
Last active August 19, 2017 07:55
Animating elements in an SVG via CSS (see live example here: https://lg.io/assets/extern/css-svg/test.html)
@keyframes hover {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(3px); }
}
#cow {
animation: hover 1.0s infinite ease;
}
#bang {
@lg
lg / just-in-time-babel.js
Last active January 28, 2017 22:51
Use ES2017 async functions on browsers that don't support it (like Safari)
// JustInTimeBabel by Larry Gadea
// Use ES2017 async functions on browsers that don't support it (like Safari)
//
// Example usage:
//
// <script src='just-in-time-babel.js'></script>
// <script>
// async function pong() {
// await new Promise(resolve => setTimeout(resolve, 1000))
// console.log("pong!")