Skip to content

Instantly share code, notes, and snippets.

View will's full-sized avatar
🆒
ه҈ͣفͤ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͣ҉ͨ҈ͧ҉ͯ҈ͮ҉ͭ҈ͤ҉ͦ҈ͥ҉ͧ҈ͩ҉ͭ҈ͨ҉ͣ҈ͪ҉ͧ҈ͭ҉ͩ҈ͤ҉ͮ҈ͯ҉ͬ҈

Will Leinweber will

🆒
ه҈ͣفͤ҈ͥ҉ͦ҈ͧ҉ͨ҈ͩ҉ͪ҈ͫ҉ͬ҈ͭ҉ͮ҈ͯ҉ͨ҈ͬ҉ͧ҈ͣ҉ͨ҈ͧ҉ͯ҈ͮ҉ͭ҈ͤ҉ͦ҈ͥ҉ͧ҈ͩ҉ͭ҈ͨ҉ͣ҈ͪ҉ͧ҈ͭ҉ͩ҈ͤ҉ͮ҈ͯ҉ͬ҈
View GitHub Profile
@will
will / ipanema.patch
Created June 10, 2022 02:23
play girl from Ipanema while your query runs
diff --git i/src/bin/psql/mainloop.c w/src/bin/psql/mainloop.c
index b0c4177..dcb4b5a 100644
--- i/src/bin/psql/mainloop.c
+++ w/src/bin/psql/mainloop.c
@@ -82,6 +82,8 @@ MainLoop(FILE *source)
/* main loop to get queries and execute them */
while (successResult == EXIT_SUCCESS)
{
+ system("killall -q afplay");
+
@will
will / init.lua
Created April 12, 2022 16:09
Neovim require all Lua files in directory
local fd = vim.loop.fs_scandir(vim.fn.stdpath('config') .. '/lua/user/')
for name in
function() return vim.loop.fs_scandir_next(fd) end
do require('user.' .. name:gsub('.lua\z', '')) end
@will
will / mode.swift
Last active March 9, 2022 16:25
print light mode dark mode changes
import Foundation
import AppKit
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
DistributedNotificationCenter.default.addObserver(
forName: Notification.Name("AppleInterfaceThemeChangedNotification"),
object: nil, queue: nil,
using: self.themeChanged(notification:)
)
@will
will / query_collations.sql
Created September 2, 2020 09:39
check collation for all public text columns postgres
SELECT
n.nspname as "Schema",
c.relname as "Name",
a.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod),
a.attrelid as table_id,
(SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
@will
will / forward.rb
Created August 3, 2020 17:14
net::ssh remote port to local socket
# on remote machine
# nc -l -p 1212
# on local machine
ssh = Net::SSH.start(remote.ip, "centos", keys_only: true, key_data: [remote.ssh_key])
tempfile = Tempfile.new("net_ssh_forward_test")
path = tempfile.path
tempfile.delete
/t/test> cat a.cr
def go
a = 0
10.times do
a += 1
end
p a
end
@will
will / a.cr
Created June 8, 2020 22:34
exponentially smoothed moving average and variance
class ExpMovingStats
def initialize(@alpha : Float32)
@mean = 0.0
@variance = 0.0
end
def update(n)
n = n.to_f32
beta = 1.0 - @alpha
http://github.com/FiloSottile/age
~> ./Downloads/age/age-keygen > key
Warning: writing to a world-readable file.
Consider setting the umask to 066 and trying again.
Public key: age1gnf3ahtvwhtpdc47jtec6t7nn2n2rrxla7wfk9kswvep66ypk5sqgz6f04
~> cat key
# created: 2020-05-29T23:02:29-07:00
# public key: age1gnf3ahtvwhtpdc47jtec6t7nn2n2rrxla7wfk9kswvep66ypk5sqgz6f04
AGE-SECRET-KEY-1N2DZHD52AGASHWJAMNVFQJGHVR9FZF77NVNVPRXTEPECZ7YD3MDQXKERX6
@will
will / 00_description.md
Last active February 24, 2020 15:58
fuzzing postgres
  • Fuzzing finds bugs feeding malformed or semi-maifomred data into a program.

  • This unexpected input can hopefully find bugs before they are found by attackers.

  • coverage guided or not

  • greg stark 2016

  • problems coverage guided and postgres

  • sqlsmith https://github.com/anse1/sqlsmith