Skip to content

Instantly share code, notes, and snippets.

View lg's full-sized avatar

Larry Gadea lg

View GitHub Profile
@lg
lg / discord-dl.sh
Last active May 5, 2024 02:52
Download channels from Discord and save as a webarchive for offline reading
#!/bin/bash
#
# Make sure to have a .env with `DISCORD_TOKEN=your_token_here` in the same directory as this script.
# Get your token as per: https://github.com/Tyrrrz/DiscordChatExporter/blob/master/.docs/Token-and-IDs.md
dce() { docker run -it --rm --env-file .env --volume "$(pwd)/out":/out tyrrrz/discordchatexporter:latest "$@"; }
ffmpeg() { docker run --rm --volume "$(pwd)/out":/out lscr.io/linuxserver/ffmpeg:latest "$@"; }
bun() { docker run -i --rm --volume "$(pwd)":/home/bun/app oven/bun:latest "$@"; }
jq() { docker run -i --rm --volume "$(pwd)":/docker-files -w /docker-files badouralix/curl-jq jq "$@"; }
@lg
lg / unattend.xsd
Created August 11, 2023 04:51
unattend.xsd / autounattend.xsd taken from Windows ADK as per https://schneegans.de/windows/unattend-schema/
<?xml version="1.0" encoding="ASCII"?>
<xsd:schema targetNamespace="urn:schemas-microsoft-com:unattend" xmlns="urn:schemas-microsoft-com:unattend"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<!--Root Elements-->
<xsd:element name="unattend">
<xsd:annotation>
<xsd:documentation>Unattend</xsd:documentation>
</xsd:annotation>
@lg
lg / amc.sh
Created July 23, 2023 09:01
amc tickets
function runcheck() {
while true; do curl -s "$1" | pup 'script#apollo-data json{}' | jq '.[] | .text | fromjson | .[] | select(.__typename=="Seat" and .available==true and .type != "Wheelchair" and .type != "Companion") | .column' | awk '{if (p == $1 - 1) {print "Found: " $1 " and " p}; p = $1}' | grep Found && say "go buy tickets $2"; sleep 5; done
}
runcheck "https://www.amctheatres.com/movies/oppenheimer-66956/showtimes/oppenheimer-66956/2023-07-23/amc-metreon-16/all/111398221" "tomorrow 2:30pm"
@lg
lg / extensions.json
Created June 30, 2023 03:30
vscode launch.json to start a server in docker and debug it (originally from awardwiz)
{
"recommendations": [
"spadin.memento-inputs"
]
}
@lg
lg / Dockerfile
Last active February 12, 2023 23:36
Dockerfile to download and build firefox for multiple architectures (run on x86_64 host/platform)
FROM ubuntu:jammy as builder
ARG FIREFOX_REF=FIREFOX_109_0_1_RELEASE
# download firefox and its build dependencies
WORKDIR /usr/local/src/firefox
ARG DEBIAN_FRONTEND="noninteractive"
RUN apt update && apt install --no-install-recommends -y mercurial python3-pip build-essential \
binutils-aarch64-linux-gnu curl rsync
RUN hg --config format.generaldelta=true init mozilla-unified \
&& echo "\n[paths]\ndefault = https://hg.mozilla.org/mozilla-unified\n\n[format]\nmaxchainlen = 10000\n" >> mozilla-unified/.hg/hgrc \
@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 / shoppers-drug-mart-covid-tests.sh
Created December 25, 2021 22:03
Checks all Shoppers Drug Marts for if they have COVID antigen tests available on a specific day
# make sure to change:
# '2021-12-25' to the date you're looking for, and
# '45.000000; -75.11111' to your latitude and longitude
# '100' to the amount of km thats max for your roadtrip out to get tested
# curl command taken from https://shoppersdrugmart.medmeapp.com/schedule/groups/Covid-19-Rapid-Screening (and removed the x-pharmacyid header)
curl 'https://gql.medscheck.medmeapp.com/graphql' \
-X 'POST' \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
@lg
lg / adding-tailscale-to-edgerouter.md
Last active April 11, 2024 07:44
Add tailscale to an EdgeRouter and surviving system upgrade

Adding tailscale to an EdgeRouter (and surviving system upgrades)

I suggest you run sudo bash on all of these so you're the root user.

Installing

  1. Download tailscale and put the files in /config/. Find the latest stable or unstable version for your EdgeRouter's processor (ex. ER4 is mips and ERX is mipself)
sudo bash    # if you havent already
@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
      }