Skip to content

Instantly share code, notes, and snippets.

@urob
urob / git_for_zmk.md
Last active July 4, 2024 00:38
Maintaining a personal ZMK fork
require "window_management"
require "sleep_management"
hs.loadSpoon("SpoonInstall")
spoon.SpoonInstall:andUse("CircleClock")
-- spoon.SpoonInstall:andUse("ClipboardTool",
-- {
-- config = { show_in_menubar = false, },
-- hotkeys = { toggle_clipboard = { { "cmd", "shift" }, "v" } },
@joshvasquez
joshvasquez / init.lua
Last active October 17, 2022 00:36
Simple Hammerspoon Configuration
-- for simpler binding of keys, define the modifiers ahead of time.
local hyper = {"cmd","alt","ctrl","shift"}
local meh = {"alt","ctrl","shift"}
-- grid size determines how the windows can be split into a grid
-- laid out evenly onto the desktop
-- grid margins defines spacing on x and y between windows and the menu
-- bar/monitor edges 0x0 if you want no space between windows.
-- for the case where you only ever need to move a window between three
@mmozeiko
mmozeiko / webcam_capture.c
Created August 28, 2019 20:25
Capture webcam device with Media Foundation API
#define COBJMACROS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <mfapi.h>
#include <mfidl.h>
#include <mfreadwrite.h>
#include <stdio.h>
#include <intrin.h>
@malcolmgreaves
malcolmgreaves / git-largest-files
Last active January 10, 2024 12:44 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Updated to use Python 3 by Malcolm Greaves.
#
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
@Necklaces
Necklaces / ufw_vpn_killswitch_tutorial.md
Last active June 2, 2024 05:26
GNU/Linux UFW VPN kill switch tutorial

GNU/Linux UFW VPN kill switch tutorial

This is a quick guide for setting up a kill switch using UFW (Uncomplicated FireWall). It is assumed you are using OpenVPN and optionally Network-Manager with network-manager-openvpn.

1. (Optional) IP Addresses

Before we can start we're going to need the IP address (or the IP addresses) of your VPN so that we can whitelist those later on, write them down. They are obviously going to be different for every VPN and VPNs with multiple servers, so I'll leave this up to you.

2. Install UFW

On some systems UFW is installed and enabled by default (Ubuntu, for example). Installation procedure is going to be different for every distribution of GNU/Linux, but it's usually something like

@turicas
turicas / virtualenv_execute.py
Created June 8, 2012 19:23
Execute Python code in a virtualenv, return its stdout and stderr
#!/usr/bin/env python
# coding: utf-8
import os
import shlex
from subprocess import Popen, PIPE
def execute_in_virtualenv(virtualenv_name, commands):
'''Execute Python code in a virtualenv, return its stdout and stderr.'''