Skip to content

Instantly share code, notes, and snippets.

@callemo
callemo / wg.sh
Last active January 2, 2025 05:25
WireGuard for OpenBSD
#!/bin/sh
gw="$(route -n show | awk '$1 == "default" { print $2 }')"
awk -v gw="$gw" '
$1 == "PrivateKey" { key = $3 }
$1 == "Address" {
addr = $3
sub(/,.*/, "", addr)
}
$1 == "DNS" { dns = $3 }
$1 == "PublicKey" { peer = $3 }
@kconner
kconner / macOS Internals.md
Last active May 6, 2025 05:33
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@amunchet
amunchet / noVNCCopyPasteProxmox.user.js
Last active April 25, 2025 22:53
Copy/Paste for noVNC Proxmox
// ==UserScript==
// @name noVNC Paste for Proxmox
// @namespace http://tampermonkey.net/
// @version 0.2a
// @description Pastes text into a noVNC window (for use with Proxmox specifically)
// @author Chester Enright
// @match https://*
// @include /^.*novnc.*/
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant none
@sindresorhus
sindresorhus / esm-package.md
Last active May 7, 2025 10:36
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@sxlijin
sxlijin / lighting_setup.md
Last active December 12, 2019 00:05
Portable nighttime sports field lighting setup

Portable outdoor nighttime sports field lighting setup

Ocean Beach pickup ultimate in SF uses the below described setup for nighttime beach frisbee games.

Regulation fields are 150' x 90', ours is probably slightly smaller.

We get 90+ min (probably 2h+) of playtime out of this setup (batteries can be upgraded if you want more time).

Bill of Materials (v2)

Kiosk Mode macOS

  1. Create two user accounts
    • Administration account
    • Kiosk Account - This account will be locked down with Parental Controls
  2. Set up remote management
  3. Install kiosk software
  • We use a role-based Apple ID (ex: webmaster@[institution].org) to manage macOS software. Managing Apps this way saves lots of headaches.
@dnknth
dnknth / Makefile
Last active April 20, 2023 18:46
Prepare an SD card with Alpine Linux for a Raspberry Pi
# Prepare an SD card with Alpine Linux for a Raspberry Pi
# See: https://wiki.alpinelinux.org/wiki/Raspberry_Pi
# Editable configuration
DISTRO = alpine
# ARCH = armhf
ARCH = aarch64
MAJOR_VERSION = 3.9
MINOR_VERSION = 2
@ryderdamen
ryderdamen / gce-to-gcs-uploads.md
Created December 4, 2018 15:43
Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

Uploading Files from Google Compute Engine (GCE) VMs to Google Cloud Storage (GCS)

I had a bit of trouble trying to configure permissions to upload files from my Google Compute Engine instance to my Google Cloud Storage bucket. The process isn't as intuitive as you think. There are a few permissions issues that need to be configured before this can happen. Here are the steps I took to get things working.

Let's say you want to upload yourfile.txt to a GCS bucket from your virtual machine. You can use the gsutil command line tool that comes installed on all GCE instances.

If you've never used the gcloud or gsutil command line tools on this machine before, you will need to initialize them with a service account.

@biquetto
biquetto / iOS: disable bounce scroll but allow normal scrolling
Created June 23, 2016 15:26
iOS: disable bounce scroll but allow normal scrolling
var content = document.getElementsById('scrollDiv');
content.addEventListener('touchstart', function (event) {
this.allowUp = (this.scrollTop > 0);
this.allowDown = (this.scrollTop < this.scrollHeight - this.clientHeight);
this.slideBeginY = event.pageY;
});
content.addEventListener('touchmove', function (event) {
var up = (event.pageY > this.slideBeginY);
var down = (event.pageY < this.slideBeginY);