Skip to content

Instantly share code, notes, and snippets.

@varenc
varenc / baskup-2021.sh
Created February 3, 2021 01:16
Fork of PeterKaminski09 baskup.sh with some improvements
#!/bin/sh
## this is a fork of https://github.com/PeterKaminski09/baskup/blob/master/baskup.sh with some bug fixes
# - improve the "Me/Friend" regex so that it only matches what its supposed to doesn't match things at the end of the line
# - The NEEDS_MODIFICATION logic was broken so just set it to always true since most everyone is running 10.13+
# - Create "OG_<contact>.txt" files that have the original, pre-regex, content in case the regex destroyed info
BACKUP_DIR=./backup
@varenc
varenc / DefaultKeyBinding.dict
Created March 11, 2021 00:37 — forked from trusktr/DefaultKeyBinding.dict
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@varenc
varenc / dnsBypassTmp.sh
Last active October 22, 2023 11:50
Temporarily bypass PiHole or DNSCrypt-proxy dns resolver on Mac
#####
# Temporarily bypass your ad blocking DNS server with this shell function. Automatically restore settings after some number of minutes.
#####
# This `dnsBypassTmp` zsh function will temporarily bypass your PiHole or DNSCrypt-proxy resolver.
# If a site is broken because of a domain you've blocked, this makes it easily to temporarily enabled that and get things working again.
#
# The only argument is the number of minutes to enable the bypass. Defaults to 2 minutes.
# example:
# $ dnsBypassTmp 5
#
@varenc
varenc / export.js
Created March 21, 2021 00:29 — forked from loilo/export.js
Browser console support for shellking4
// Copy this whole snippet to your browser console
var dbName = prompt("What's the name of the database to export?")
;(async () => {
try {
var dbExists = await new Promise(resolve => {
var request = window.indexedDB.open(dbName)
request.onupgradeneeded = e => {
e.target.transaction.abort()
@varenc
varenc / resolutionSwitch.sh
Last active April 5, 2021 02:14
Displayplacer workaround: switch to unscaled modes by looking up mode number
# This is a workaround for https://github.com/jakehilborn/displayplacer/issues/35 and https://github.com/jakehilborn/displayplacer/issues/31
# Displayplacer ignores "scaling:off" and always enabling scaling unless you switch via mode number instead.
# It even turns scaling on for non-sense situations like when you're setting the resolution to your
# display's physical resolution resulting in a subtle but serious performance hit.
function resolutionSwitch() {
# check the output of `displayplacer list` and pass in everything after the "mode xx: " of the desired settings shown
# if you want "scaling:off", just don't include scaling and pass in '$' at the end to match against the end
# examples:
@varenc
varenc / keyboard_leds.c
Last active June 6, 2024 00:17
Toggle the capslock light/led without actually enabling capslock! for macOS
/*
**********
2024-06-05:
On recent versions of macOS (14/Sonoma+), this code no longer works.
However I found that this project does still work: https://github.com/damieng/setledsmac/tree/master
Though if anyone knows how to fix this script I'd love to learn more.
@varenc
varenc / ublock_custom_scripts.js
Last active February 11, 2025 01:00
uBlock origin custom scripts
/// allow-but-log-webassembly.js
(function() {
var OriginalWebAssembly = WebAssembly;
var counter = 0;
var logMessage = function(message) {
if (counter < 10) {
console.log(`CV SAYS: ${message}`);
} else if (counter === 10) {
console.log('CV SAYS: WebAssembly log messages now suppressed');
counter++;
@varenc
varenc / apple tv 4k diff.patch
Last active April 20, 2021 21:01
Apple TV 4k 2021 tech spec diff. (very minor)
--- old 2021-04-20 12:52:29.039828036 -0700
+++ new 2021-04-20 12:52:29.792895036 -0700
@@ -1,58 +1,58 @@
Size and Weight
Apple TV 4K
Height: 1.4 inches (35 mm)
Width: 3.9 inches (98 mm)
Depth: 3.9 inches (98 mm)
Weight: 15 ounces (425 g)
@varenc
varenc / dropbox_pause_resume_example.applescript
Created May 1, 2021 03:01
Pause and Resume Dropbox's syncing from the command line with AppleScript
tell application "System Events"
-- Pause syncing
click menu bar item 1 of menu bar 2 of application process "Dropbox"
click menu item "Pause Syncing" of menu 1 of menu bar item 1 of menu bar 2 of application process "Dropbox"
delay 2
-- Now re-enable syncing
click menu bar item 1 of menu bar 2 of application process "Dropbox"
click menu item "Resume Syncing" of menu 1 of menu bar item 1 of menu bar 2 of application process "Dropbox"
end tell
@varenc
varenc / system-wide-clipboard.zsh
Last active August 31, 2024 23:38 — forked from welldan97/system-wide-clipboard.zsh
Zsh copy & paste system wide for OS X, like in emacs
## 2020-05-16: Changed `echo` to `printf` so that backslashes are not interpretted by echo
## and so that CUTBUFFER shows up exactly in the pasteboard without modification
pb-kill-line () {
zle kill-line
printf '%s' $CUTBUFFER | pbcopy
}
pb-kill-whole-line () {
zle kill-whole-line