Skip to content

Instantly share code, notes, and snippets.

View ThatsJustCheesy's full-sized avatar

Ian Gregory ThatsJustCheesy

View GitHub Profile
@ThatsJustCheesy
ThatsJustCheesy / Navigate UTSC Website.js
Last active July 31, 2022 20:49
Always show side menu on UTSC's website because people (like me) forget it exists
// ==UserScript==
// @name Navigable UTSC Website
// @description Auto-shows the side menu on UTSC's website, because people forget it exists and attempt to use Google instead.
// NOTE: Small window sizes break this.
// @match *://www.utsc.utoronto.ca/*
// ==/UserScript==
function inIframe() {
try {
return window.self !== window.top;
@ThatsJustCheesy
ThatsJustCheesy / ParagraphsToSlides.vba
Created July 30, 2022 01:37
Make PowerPoint slides from plain text paragraphs
' This macro creates slides from plain text on your clipboard.
' Two consecutive line breaks begin a new slide.
' New slides will be duplicates of the selected slide,
' which must contain a single text box and nothing else.
'
' Usage:
' 1. Prepare plain text paragraphs of your slide content
' 2. Copy the text to your clipboard
' 3. Select a slide that contains a single text box with desired formatting
' 4. Run ParagraphsToSlides as a macro
@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 %}
@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 / 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
#include<stdio.h>
#include<math.h>
int
main
()
{;
int
x=
((
void
@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
@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 / 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 / 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