Skip to content

Instantly share code, notes, and snippets.

@bconway
bconway / acpi.diff
Last active February 2, 2024 18:47
Detect and mitigate uncontrolled ACPI GPE interrupt storms on OpenBSD (7.3, 7.3-current)
diff --git sys/dev/acpi/acpi.c sys/dev/acpi/acpi.c
index 853bad1ab..26a5c1702 100644
--- sys/dev/acpi/acpi.c
+++ sys/dev/acpi/acpi.c
@@ -52,6 +52,9 @@
#define APMDEV_NORMAL 0
#define APMDEV_CTL 8
+#define GPE_RATE_MIN_CYCLE 5 /* seconds */
+#define GPE_RATE_MAX 1000 /* per second */
@kmatt
kmatt / void-wsl.txt
Last active May 5, 2024 05:13
Install Void Linux on WSL2
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
# prompt ">" indicates Powershell commands
# prompt "$" are Linux shell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
@dansanderson
dansanderson / p8_devterm_printwatcher.py
Last active June 11, 2022 23:38
Prints .lua.png files exported from PICO-8 on a DevTerm
# The PICO-8 text printer for the ClockworkPi DevTerm!
#
# This Python script allows you to print text directly from the PICO-8 source
# code editor. The script runs in the background and watches for you to execute
# the "EXPORT FILE.LUA.PNG" command. It does some light processing of the
# generated image file, then sends it to DevTerm's thermal printer.
#
# This is mostly just a joke/hack for the purposes of this tweet:
# https://twitter.com/dan_sanderson/status/1434253649266364417?s=20
#
@roalcantara
roalcantara / lua_5_4.md
Created February 28, 2021 02:46
Lua 5.4 - Cheat Sheet

Lua - Beginners Guide

Printing

print("Hello World")

Comments

--this is a comment
@benkuhn
benkuhn / views.sql
Created June 10, 2020 12:24
Athena view to enrich Cloudfront logs
CREATE OR REPLACE VIEW cloudfront_logs_plus AS
SELECT *,
replace(replace(user_agent, '%25', ' '), '%20', ' ') as user_agent_decoded,
(sc_content_type='text/html' and status = 200 and uri not like '/theme/pages/%') as is_pageview,
(referrer like '%benkuhn.net%' or referrer like '%dvmskfca82zxm.cloudfront.net%') as is_internal_referrer,
(
user_agent like 'Zapier'
or user_agent like 'SimplePie%'
or user_agent like 'Feedbin%'
or user_agent like 'Fever/%'
@jperkin
jperkin / edgerouter.md
Last active March 25, 2024 13:22
OpenBSD/octeon EdgeRouter Lite

This is a nifty little device for under £100 suitable for a home router.

I am using one running OpenBSD 6.8 for my AAISP PPPoE connection (avoiding the supplied VMG1312-B10A which has a number of issues).

Installation

I bought a SanDisk 16GB USB stick as there were reports the supplied USB stick isn't particularly reliable, plus it's nice to keep it separate in case of backup or selling the device in the future.

Download the OpenBSD miniroot68.img file system and dd(1) it, for example on macOS (assuming /dev/disk2):

@jmiserez
jmiserez / export_google_music.js
Last active December 20, 2023 01:45
(fixed/updated 2016-05-10) Export your Google Music Library and Playlists (Google Play Music All Access) (see http://webapps.stackexchange.com/questions/50311/print-playlist-from-google-play-music for more)
// Copyright 2016 Jeremie Miserez <jeremie@miserez.org>
//
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF O
@AndrewRadev
AndrewRadev / ginitpull.vim
Last active March 9, 2016 22:58
Start a github pull request from Vim
" Usage:
"
" :Ginitpull [remote-name] [branch-name]
"
" Initiates a github pull request in the default browser, from the given
" branch name to master, on the given remote. Tab-completes both arguments.
"
" If called without any arguments, defaults to the "origin" remote and the
" current branch name, which is probably what you usually want.
"
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@tobias
tobias / run_tags.rb
Created January 1, 2009 16:44
A script for generating TAGS from a git hook.
#!/usr/bin/ruby
#-*-ruby-*-
# A script to run ctags on all .rb files in a project. Can be run on
# the current dir, called from a git callback, or install itself as a
# git post-merge and post-commit callback.
CTAGS = '/opt/local/bin/ctags'
HOOKS = %w{ post-merge post-commit post-checkout }
HOOKS_DIR = '.git/hooks'