Skip to content

Instantly share code, notes, and snippets.

View Aldaviva's full-sized avatar
🆒
This user is COOL

Ben Hutchison Aldaviva

🆒
This user is COOL
View GitHub Profile
@Aldaviva
Aldaviva / youtube-playlist-length.js
Created August 5, 2017 11:40
YouTube playlist length calculator
Array.prototype.map.call(document.querySelectorAll(".timestamp span"), function(span){ var minSecStrings = span.firstChild.nodeValue.split(":"); return parseInt(minSecStrings[0], 10)*60+parseInt(minSecStrings[1], 10); }).reduce(function(prev, curr){ return prev + curr; }, 0);
@Aldaviva
Aldaviva / pull-requests.md
Created August 5, 2017 12:23
How to modify and merge GitHub pull requests
  1. Clone your repo.
  2. curl -L https://github.com/Aldaviva/webscale/pull/3.patch | git am -3
  3. If there are merge conflicts, fix them, then git am --continue.
  4. Make any local changes you want.
  5. git add -A
  6. Commit your changes with Closes #3 at the end of the commit message.
    • git commit --amend (to modify the pull request commit)
    • git commit (to add a new commit of you own).
  7. If you want to squash multiple WIP commits into one, use git rebase -i origin/master.
  8. Push.
@Aldaviva
Aldaviva / delete-mkv-tags.sh
Last active December 28, 2017 17:22
Delete Matroska tags
# requires mkvmerge (https://mkvtoolnix.download)
mkdir notags
find . -depth 1 -name "*.mkv" -exec mkvmerge --title "" -o "notags/{}" --no-track-tags --no-global-tags {} \;
mv notags/* .
rm -r notags
@Aldaviva
Aldaviva / cart
Last active March 28, 2018 05:30
Carthage's CLI sucks. I need to pass all these flags, it can't remember them. You have to bootstrap each time you pull? "Bootstrap" means first time! "Update" is too ambiguous. The hidden cache gets corrupted. There, I fixed it for you, Carthage developers, you fucking scum of the earth.
#!/bin/bash
PLATFORM=Mac
function main {
if [ "$1" == "repin" ]
then
update
elif [ "$1" == "install" ]
then
@Aldaviva
Aldaviva / Maximum tab width.md
Last active June 20, 2024 10:58
How to make tabs wider in browsers and operating systems

By increasing the maximum width of tabs and taskbar buttons, you can

  • see more of their text labels without truncation,
  • have a larger hit area for your mouse pointer, and
  • make better use of the space on your wide monitor.

This does not break the resizing logic when you open more tabs, so the worst-case scenario behavior is unchanged. For example, you could set the maximum tab width to a size at least as wide as your monitor. Then, when you have one tab open, it will consume 100% of the available space. Next, when you open another tab, they will each consume 50% of the available space. When the minimum tab width is reached, the existing overflow or scrolling logic will still apply.

Make tabs wider in
@Aldaviva
Aldaviva / Vivaldi customizations.md
Last active September 8, 2021 09:10
Customizations to the Vivaldi web browser, including a fancy persistence strategy.
@Aldaviva
Aldaviva / Fix Registry.md
Last active October 15, 2023 11:21
Remove cruft from Windows context menus and file associations that kept getting added back by updates

This gist was moved to a GitHub repository to make it easier to diff changes and keep in sync with a clone on a filesystem.

@Aldaviva
Aldaviva / Stopwatch.java
Created January 30, 2019 05:15
How long does an operation take in Java?
final long start = System.nanoTime();
// operation being timed
LOGGER.trace("Operation took {} ms", (System.nanoTime() - start) / 1_000_000);
@Aldaviva
Aldaviva / curl cheat sheet.md
Last active May 19, 2022 14:16
Curl Cheat Sheet: How is anyone supposed to remember curl commands? I hate command-line utilities.

curl cheat sheet

$ curl [arguments] 'https://my.url.com/path/file.ext?a=b&c=d'

Request

Nickname Argument Description
Insecure -k Accept invalid TLS server certificates
@Aldaviva
Aldaviva / unicode-code-units.md
Last active October 8, 2022 13:02
Examples of Unicode codepoints with different UTF-8 and UTF-16 byte counts. Try pasting these into your program to see if it can handle multi-byte characters.
Glyph Unicode codepoint UTF-8 code units UTF-8 bytes UTF-16 code units UTF-16LE bytes
B U+0042 1 0x42 1 0x42 0x00
ÿ U+00FF 2 0xC3 0xBF 1 0xFF 0x00
U+2603 3 0xE2 0x98 0x83 1 0x03 0x26
💩 U+1F4A9 4 0xF0 0x9F 0x92 0xA9 2 0x3D 0xD8 0xA9 0xDC