Skip to content

Instantly share code, notes, and snippets.

View ThatsJustCheesy's full-sized avatar

Ian Gregory ThatsJustCheesy

View GitHub Profile
@ThatsJustCheesy
ThatsJustCheesy / HIServicesPrivate_v1.h
Created August 21, 2017 00:39
Private interfaces in HIServices.framework (subframework of ApplicationServices.framework) that message the Dock to set preferences on-the-fly.
// HIServicesPrivate.h v1
// By ThatsJustCheesy
// TO USE THESE INTERFACES, you MUST link against ApplicationServices.framework.
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
@ThatsJustCheesy
ThatsJustCheesy / KSImageView.h
Last active August 18, 2018 23:40 — forked from vigorouscoding/KSImageView.h
Forked from @vigorouscoding 's original and modernized. NSImageView subclass to get the filename of the dropped image and to disable deleting and cutting the image. The class sends a "KSImageDroppedNotification" with the image filename in the userinfo dictionary. vigorouscoding got the idea from: http://www.cocoabuilder.com/archive/cocoa/121824-…
#import <Cocoa/Cocoa.h>
@interface KSImageView : NSImageView
@end
@ThatsJustCheesy
ThatsJustCheesy / PreferencesViewController.swift
Last active August 30, 2019 21:14 — forked from mminer/PreferencesViewController.swift
NSTabViewController for preferences window that resizes itself to fit activated tab view.
// Thanks to mminer on GitHub
// https://gist.github.com/mminer/caec00d2165362ff65e9f1f728cecae2
import Cocoa
class PreferencesViewController: NSTabViewController {
private lazy var tabViewSizes: [NSTabViewItem: NSSize] = [:]
private var lastSelectedTabViewItem: NSTabViewItem? = nil
@ThatsJustCheesy
ThatsJustCheesy / init.lua
Last active March 11, 2024 17:18
Hammerspoon web browser picker (set Hammerspoon as your default web browser and add this code to your config)
hs.urlevent.httpCallback = function(scheme, host, params, fullURL)
if host == nil then
host = 'file'
end
local success, _, res = hs.osascript.applescript('choose from list {"Safari", "Brave"} with prompt "Open '..host..' with…"');
local app
if success and res:match('Safari') ~= nil then
app = 'com.apple.Safari'
elseif success and res:match('Brave') ~= nil then
app = 'com.brave.Browser'
@ThatsJustCheesy
ThatsJustCheesy / YouTube - Hide End Cards (unless hovering).user.css
Last active February 26, 2021 06:15
Remove suggestion walls from YouTube embeds and the end of videos
/* ==UserStyle==
@name YouTube No Suggested Videos
@author Ian Gregory (igregory.ca)
@description Fork of https://userstyles.org/styles/101376/disable-youtube-video-wall
@version v1.0.0
@namespace igregory.ca
@license MIT
==/UserStyle== */
@-moz-document regexp(".*")
@ThatsJustCheesy
ThatsJustCheesy / ?
Last active January 13, 2021 21:24
bash script that describes typical filesystem objects—lists directories, describes files, and resolves links on the way
#!/bin/bash
script_canonical_name='?'
file="${1:-$(pwd)}"
if [[ -h "$file" ]]
then
echo "$script_canonical_name: is a link to $(readlink "$file")"
file=$(realpath "$file")
fi
#include<stdio.h>
#include<math.h>
int
main
()
{;
int
x=
((
void
@ThatsJustCheesy
ThatsJustCheesy / dequarantine-and-open.sh
Created July 4, 2021 05:58
macOS script: Open downloaded file(s) bypassing gatekeeper dialog
#!/bin/bash
# Either use from the command line, or put in an Automator workflow
# that takes files as input and save it as a Quick Action.
# For bonus points, assign a nice keyboard shortcut.
for file
do
xattr -r -d com.apple.quarantine "$file"
open "$file"
done
@ThatsJustCheesy
ThatsJustCheesy / gist:861f02c6c28e00e725c29cd13744be85
Created October 11, 2021 17:55
Stupid simple instant messaging via netcat with desktop notifications
nc -l $IN_PORT | bash -c "while true; do read msg; osascript -e \" display notification \\\"\$msg\\\" \" & done"
nc $OUT_ADDRESS $OUT_PORT
@ThatsJustCheesy
ThatsJustCheesy / curry.cr
Created July 1, 2022 04:30
Crystal Proc#curry method (implemented with macros)
struct Proc(*T, R)
def curry
{% begin %}
{% for i in 0...T.size %}
->(arg_{{i}} : {{T[i]}}) {
{% end %}
self.call(
{% for i in 0...T.size %}
arg_{{i}},
{% end %}