Skip to content

Instantly share code, notes, and snippets.

View libsteve's full-sized avatar

Steven Brunwasser libsteve

View GitHub Profile
@libsteve
libsteve / BISAC Subject Headings (2024-11-16).csv
Last active November 16, 2024 18:18
A Swift script that scrapes the BISG website for the BISAC Subject Headings to prints a CSV table with all the subject headings.
ANT000000 ANTIQUES & COLLECTIBLES / General
ANT056000 ANTIQUES & COLLECTIBLES / Advertising
ANT002000 ANTIQUES & COLLECTIBLES / Art
ANT003000 ANTIQUES & COLLECTIBLES / Autographs
ANT005000 ANTIQUES & COLLECTIBLES / Books
ANT006000 ANTIQUES & COLLECTIBLES / Bottles
ANT007000 ANTIQUES & COLLECTIBLES / Buttons & Pins
ANT057000 ANTIQUES & COLLECTIBLES / Buying & Selling / General
ANT057010 ANTIQUES & COLLECTIBLES / Buying & Selling / Auctions & Dealerships
ANT057020 ANTIQUES & COLLECTIBLES / Buying & Selling / Estate Sales & Storage Units
@libsteve
libsteve / yt-remove-unavailbe-videos.js
Created June 4, 2024 16:59
A bookmarklet to automatically remove privated, deleted, and watched videos from a YouTube Watch later playlist.
javascript: (function(){
let success = true;
const interval = setInterval(function(){
const progress = 'contains(@style, "width: 100%;")'
+ ' or contains(@style,"width: 99%;") or contains(@style,"width: 98%;")'
+ ' or contains(@style,"width: 97%;") or contains(@style,"width: 96%;")'
+ ' or contains(@style,"width: 95%;") or contains(@style,"width: 94%;")'
+ ' or contains(@style,"width: 93%;") or contains(@style,"width: 92%;")'
+ ' or contains(@style,"width: 91%;") or contains(@style,"width: 90%;")';
const menu = document.evaluate('//*[*[contains(@class,"ytd-thumbnail")]['+progress+']'
@libsteve
libsteve / Toggle Comments in C.md
Created May 12, 2024 21:40
Toggle Comments in C

Toggle Comments in C

There are special combinations of inline and multiline comments in C that you abuse exploit take advantage of utilize to comment out one of two mutually-exclusive code blocks, and then easily swap between them.

Toggling Multiline Comments

In this example, the first main function is compiled, while the second is commented out.

@libsteve
libsteve / let_if.h
Last active May 5, 2024 15:19
A control-flow construct in C for scoped variable declarations that satisfy a follow-up conditional expression.
//
// let_if.h
//
// A control-flow construct in C for scoped variable declarations that satisfy
// a follow-up conditional expression.
//
// let_if (<declaration>; <condition>) {
// <code-block>
// }
//
@libsteve
libsteve / iexp.c
Last active January 7, 2024 06:24
Get an integer mantissa for floating-point values in C
#include "iexp.h"
#include <float.h>
#include <math.h>
#include <stddef.h>
// https://stackoverflow.com/questions/7812044/finding-trailing-0s-in-a-binary-number/36791297#36791297
// Manually get two's compliment with (~integer + 1) instead of arithmatic
// negation because signed integer representation is implementation-defined
// behavior, so we can't always assume that negative integers are represented
// with two's complement instead of one's complement or signed magnitude.
@libsteve
libsteve / ConstantClass.m
Last active September 19, 2024 20:25
Compile-time constant classes in Objective-C
//
// ConstantClass.m
//
// An example for how to create compile-time constant Objective-C objects that
// can be assigned to any static const variable.
//
// Compile with -fno-objc-arc to allow overriding of retain/release methods.
//
#import <Foundation/Foundation.h>
@libsteve
libsteve / firefox.sh
Last active April 14, 2024 10:18
Launch Firefox from Steam Deck's "Gaming Mode".
#!/bin/bash
##
## Launch Firefox from Steam Deck's "Gaming Mode".
##
## Although it doesn't provide a perfect browsing experience, this script
## at least makes sure that menus and windows appear as they're supposed to.
##
## INSTRUCTIONS:
##
## - Save this file to the ~/.local/bin directory.
@libsteve
libsteve / desktopmode.sh
Last active January 28, 2025 01:51
Launch Steam Desk's "Desktop Mode" from within "Gaming Mode"
#!/bin/bash
#
# Launch Steam Desk's "Desktop Mode" from within "Gaming Mode".
# https://www.reddit.com/r/SteamDeck/comments/wycp1r/comment/ilw1cov/
# https://www.reddit.com/user/FineWolf/
# Friday, August 26, 2022
#
# Commented by Steven Brunwasser
# Sunday, October 23, 2022
#
@libsteve
libsteve / slideslive-dl.swift
Last active November 28, 2021 19:38
Download the HOPL IV sessions from SlidesLive
#!/usr/bin/env swift
//
// Copyright 2021 Steven Brunwasser
//
// 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:

Keybase proof

I hereby claim:

  • I am stevebrun on github.
  • I am sbrun (https://keybase.io/sbrun) on keybase.
  • I have a public key ASDdAuz7l8NXr4dTieWLCCHVHVrxezxED0cYXn5kPvymyAo

To claim this, I am signing this object: