Skip to content

Instantly share code, notes, and snippets.

@malloc47
malloc47 / README.md
Last active January 27, 2020 23:41
OS X Sierra Keybindings Per Application Using Hammerspoon

OS X Sierra + VirtualBox + Hammerspoon

I prefer different modifier keybindings for my VM vs. native OS X, but VirtualBox (unlike VMWare/Parallels) passes the keyboard through to the VM natively without the ability to remap it on the way through.

Apparently one would normally use Karabiner to do all manner of trickery to remap keys per application etc. but support for this utility was broken in OS X Sierra. Instead, I use a pair of scripts:

@dmn001
dmn001 / apple tv screensavers download command.txt
Last active December 9, 2023 00:50
apple tv screensavers
cat urls.csv | sed 's/\([^,]*\),\(.*mov\)\r/wget "\1" -O "\2"/' | sh
the location and time of day are prepended to the filename.
@szarroug3
szarroug3 / split_audiobook_chapters.py
Last active August 15, 2018 22:50
Split audiobook into chapters
#!/usr/bin/env python
"""
Script to split audiobook chapters into separate files using metadata
"""
from __future__ import print_function
import os
import re
@nitrag
nitrag / convert_m4b.sh
Last active May 22, 2024 19:08
Audibook convert m4b to mp3. This will split into chaptered mp3 files and automatically reconfigure proper ID3v2 tags.
#!/bin/bash
#
# sudo apt-get install id3v2 ffmpeg
#
# USAGE:
# cd /book title/
# bash ~/this_script_path.sh
# rm *.m4b (you need to manually remove the original in case something goes wrong)
#
#
@sparksbat
sparksbat / ProcessUtils.cs
Created October 24, 2017 21:23
C# Get Foreground Process
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace FGWindow
{
class ProcessUtils
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
@t184256
t184256 / example_remap.py
Created January 19, 2018 03:26
A thoroughly annotated example on keyboard remapping with evdev/uinput.
#!/usr/bin/python3
# CC0, originally written by t184256.
# This is an example Python program for Linux that remaps a keyboard.
# The events (key presses releases and repeats), are captured with evdev,
# and then injected back with uinput.
# This approach should work in X, Wayland, anywhere!
@niclasnilsson
niclasnilsson / config
Last active June 17, 2021 13:30
Example ~/.ssh/config for dealing with JSch and public key authentication with encrypted (password protected) keys.
# Example ~/.ssh/config for dealing with JSch problems regarding
# ssh public key authentication with encrypted (password protected) keys.
#
# First, a problem description and a couple of solutions that worked for me,
# (in March 2018 on MacOS High Sierra) and in the bottom youäll find an example
# config that doesn't interfere with JSch's use of the ssh-agent.
#
#
# Problem description:
# --------------------
@christian-eriksson
christian-eriksson / window_finder_bash.sh
Last active January 24, 2022 23:23
Script using xprop and grep to look for a provided (as cmd-line argument) WM_CLASS. The script identifies a window which has a grandparent with 2 children somewhere in it's tree.
#!/bin/bash
# The script is looking for a window with a given WM_CLASS property. The window
# will be attached to the root node (R in the graph below), the root note is
# what you get from 'xprop -root'. There are two different types of windows with
# the same WM_CLASS (Q and W) but their tree structures are different. However,
# the tree structure of the two windows are different as seen in the graph
# below.
#
# R
@flozz
flozz / gnome_shell_wayland_meta_window_hack.py
Created May 14, 2018 18:06
A small hack that allows to manipulate windows on GNOME Shell / Wayland
#!/usr/bin/env python
import json
import pydbus
GNOME_SHELL = "org.gnome.Shell"
META_WINDOW_JS = """
(function(params) {
@noelbundick
noelbundick / LICENSE
Last active May 24, 2024 09:10
Exclude WSL installations from Windows Defender realtime protection
MIT License
Copyright (c) 2018 Noel Bundick
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: