Skip to content

Instantly share code, notes, and snippets.

View andyvanee's full-sized avatar

Andy Vanee andyvanee

View GitHub Profile
@andyvanee
andyvanee / init.lua
Last active April 4, 2024 18:51
Hammerspoon config for window management
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "R", function() hs.reload() end)
hs.alert.show("Config loaded")
-- Fullscreen
hs.hotkey.bind({"cmd", "alt"}, "1",
function()
local window, screen = getFocusedWindowAndScreen()
window.w = screen.w
window.x = screen.x
window.y = screen.y
@andyvanee
andyvanee / README.md
Last active March 24, 2024 20:08
GoDaddy + LetsEncrypt Certificate Installation

GoDaddy + LetsEncrypt Certificate Installation

Valid as of September 2020

note: if you have shell access and want to automatically renew, follow the steps on this page instead

Much of the current documentation on this from LetsEncryt and Godaddy suggests that this is a very hard thing to do - but I'm okay with spending 10 minutes every 2-3 months for a free, quality SSL certificate. If you are too, here's how I do it.

Problem

Google search has gotten objectively worse with increasing crawling, SEO farming and AI generated bullshit. I believe the only sane solution is to explicitly whitelist websites with known ethical publishing guidelines. I am going to attempt to build a list of sites that I trust for common search contexts.

Developer Results

General search (not focused on a specific technology):

@andyvanee
andyvanee / .ssh_config
Last active November 30, 2023 04:19
Fix unix_listener too long for Unix domain socket
Host *
ControlPath ~/.ssh/control/%C
ControlMaster auto
@andyvanee
andyvanee / MyModule.py
Created September 20, 2012 07:26
Embed Python in Objective-C (without PyObjC)
def my_func():
return "embedding?"
@andyvanee
andyvanee / podcasts.md
Created February 4, 2022 20:03
Podcasts I'm currently listening to

Arts/Culture

  • The Anthropocene Reviewed
  • Life Kit (NPR)
  • Dear Hank & John
  • On Being with Krista Tippet
  • A Slight Change of Plans with Maya Shankar
  • Factually! with Adam Conover
  • Philosophize This!
  • No Such Thing As A Fish
@andyvanee
andyvanee / README.md
Last active December 21, 2021 21:56
Directus http endpoint integration

The documentation on Directus 9 extensions is scarce. This is a slightly more detailed implementation than the example given.

Notes:

  • router is an express.Router object
  • services is a bunch of getters of available services (see below)
  • database is the knex instance
  • directus.auth.refresh() will throw. It's assumed that the user has authenticated in before calling fetchJson
@andyvanee
andyvanee / README.md
Last active August 19, 2021 19:10
Basic profiler for your node scripts

Basic profiler for your node scripts

Usage
import "./profile.js"

// do some stuff...
const items = [...new Array(100)].map((x, i) => i)
for (let i of items) {
@andyvanee
andyvanee / tagProps.js
Created August 12, 2020 22:27
tagProps lit-element directive
import { directive } from "https://unpkg.com/@polymer/lit-element/lit-element.js?module"
const stateMap = new WeakMap()
export const tagProps = directive((tag, props = {}) => part => {
let state = stateMap.get(part)
const el = () => document.createElement(tag)
if (state === undefined) {
state = { tag, element: el() }
stateMap.set(part, state)
@andyvanee
andyvanee / dirsum.js
Last active September 1, 2020 20:36
Calculate the checksum of a directory of files
import fs from "fs"
import crypto from "crypto"
import path from "path"
/**
* Calculate the checksum of a directory of files
*/
const dirsum = async basepath => {
const hash = crypto.createHash("sha1")
const dirOpts = { withFileTypes: true }