Skip to content

Instantly share code, notes, and snippets.

@varenc
varenc / audacity.rb
Last active February 8, 2021 09:40
Unofficial Hombrew Cask for Audacity 2.3.2 (recent 64-bit version). Get around Fosshub's limitations
# Unofficial Hombrew Cask for Audacity 2.3.2 (recent 64-bit version)
# Made entirely for fun and to demonstrate how to get around fosshub's limitations.
# Problem: Audacity's binary is hosted on fosshub and they don't provide a fixed url! The seems to intentionally try to prevent "hot-linking".
# Solution: Make a request to fosshub's special XHR endpoint to get the signed download url. Then just pass that URL to Homebrew
require 'net/http'
require 'json'
require 'uri'
@varenc
varenc / dropbox_link_fixer_daemon.py
Last active September 24, 2020 22:19
Make all Dropbox shared links directl links. Watch for all links with ?dl=0 and change that to ?raw=1
@varenc
varenc / MediaRemoteEvents.m
Last active April 21, 2022 18:31 — forked from dnicolson/MediaRemoteEvents.m
Use the MediaRemote private framework to get and set the playing state of the Touch Bar based on media change events
// varenc's very simple fork of dnicolson's gist.
//
// changelog: on start immediately output the current MediaRemote state
// todo: might turn this into a command line util for personal workflow automation.
//
// clang -x objective-c -framework Foundation -framework MediaRemote -F /System/Library/PrivateFrameworks MediaRemoteEvents.m -o MediaRemoteEvents.m
// ./MediaRemoteEvents.m
#import <Foundation/Foundation.h>
@varenc
varenc / README.md
Created May 5, 2020 07:01 — forked from klausondrag/README.md
Pinyin support for Language Learning with Netflix Extension
@varenc
varenc / ^⠀ ​‎‎Slack Desktop Package.json README
Last active July 14, 2021 00:28
Slack desktop app's package.json
Nothing spicy here. I just found some things interesting like all their scripts and that it looks like they host on github.
I'm uploading the 4.5.0 version and the 4.7.0 version. Compare the diff and you can see some things that changed! Like their switch to yarn.
@varenc
varenc / dontforget.sh
Last active July 25, 2020 08:34 — forked from ttscoff/dontforget.bash
Quick reminders from Terminal (bash)
#!/bin/bash
# dontforget
#
# A stupid script for short term reminders in bash
#
# UPDATE: Tweaked to work on macOS catalina in 2020! (no more launchbar.app). Also removed the `say`
#
# Arguments just need to contain a number and a bunch of words.
#
# The number can be anywhere in the arguments, but there shouldn't
@varenc
varenc / capstoggle.sh
Created August 19, 2020 03:53
Toggle Caps Lock light on macOS Catalina from a shell scripts/terminal
#!/usr/bin/osascript -l JavaScript
# Usage: capstoggle.sh [1 or 0, defaulting to 0]
# Pass in "1" to turn caps lock on. By default it turns caps lock off (0)
#
# Make this an executable shell script by running `chmod +x capstoggle.sh`
# Then `./capstoggle.sh 1` to turn caps lock on, and hence toggle the caps lock keyboard light!
# You can make your caps lock light flash 5 times by running this
# for i in {0..5}; do ./capstoggle.sh 1; ./capstoggle.sh 0; done
ObjC.import("IOKit");
/* file: main.c function: get and set capslock state complie: gcc -std=c99 -framework IOKit -framework CoreFoundation -o
* capslock main.c usage: ./capslock [0|1|-1] 0 : capslock off 1 : capslock on -1 : toggle capslock state : print
* current capslock state (0|1) * written and published as free software by Hiroto, 2015-06 */
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>
#include <libgen.h> // basename
#define CAPSLOCK_OFF 0
#define CAPSLOCK_ON 1
@varenc
varenc / _broken-apple-manpage-urls.md
Last active November 12, 2020 03:07
Broken docs: 50% of apple.com links in macOS manpages are broken
@varenc
varenc / sample of geekbench upload request.sh
Created November 12, 2020 20:22
Geekbench result submission request
curl -H 'Host: browser.geekbench.com' -H 'Content-Type: multipart/form-data; boundary=0xKhTmLbOuNdArY' -H 'If-None-Match: W/"3b9560bf045c1985f322882e765a78d0"' -H 'Accept: */*' -H 'User-Agent: Geekbench%205/503563 CFNetwork/1128.0.1 Darwin/19.6.0 (x86_64)' -H 'Accept-Language: en-us' --data-binary '--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="document"
{
"date": "2020-11-12 20:17:01 -0800",
"document_type": 0,
"document_version": 5,
"branch": "corktown-master-build",
"build": 503563,
"checksum": "c5532fa41721d5996861adc9e323147fa31a4d12",