This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Print a compact version of the current working directory. | |
# The home directory is replaced with ~, and long paths are truncated to the final part with < as a marker. | |
# Examples: | |
# /home/example/Documents becomes ~/Documents | |
# /example/of/a/really/really/long/path becomes <ly/really/long/path | |
# The maximum length can be set using the LIMIT variable. | |
LIMIT=20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Char (toUpper) | |
import Data.List (sort) | |
import System.Environment (getArgs) | |
import System.Exit (exitWith, ExitCode(..)) | |
data CheckAnagramError = NotEnoughArguments | EmptyInput | |
isAnagram :: String -> String -> Bool | |
isAnagram x y = normalize x == normalize y | |
where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Sort Pittsburgh Regional Transit bus schedules numerically | |
// @version 2 | |
// @include https://www.rideprt.org/all-schedules/ | |
// @grant none | |
// ==/UserScript== | |
// This script is dedicated to the public domain under Creative Commons CC0 1.0 Universal | |
// <https://creativecommons.org/publicdomain/zero/1.0/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Usage: ./makepin.py [number of digits, default 4] | |
import secrets | |
import sys | |
digit_count = int(sys.argv[1]) if len(sys.argv) >= 2 else 4 | |
pin = secrets.randbelow(10**digit_count) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby --version | |
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux-gnu] | |
$ irb | |
irb(main):001:0> /\p{Word}/.match?("\u00B2") # Expected to be true based on description of \p{Word} in Regexp docs | |
=> false | |
irb(main):002:0> /\p{Number}/.match?("\u00B2") # U+00B2 is a Number character | |
=> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Enable Direct Password Input on TreasuryDirect | |
// @version 1 | |
// @include https://www.treasurydirect.gov/* | |
// @grant none | |
// ==/UserScript== | |
document.querySelector('input.pwordinput').readOnly = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# URL in the phishing e-mail is https://t.co/tmI9IHHvTk?signature=newsletter&trackingid=dpx9Ve0JW3iV15k4k4itEmDGAuJQEpNq | |
# Times are UTC-7 | |
$ wget -O /dev/null 'https://t.co/tmI9IHHvTk?signature=newsletter&trackingid=dpx9Ve0JW3iV15k4k4itEmDGAuJQEpNq' | |
--2022-03-18 13:30:42-- https://t.co/tmI9IHHvTk?signature=newsletter&trackingid=dpx9Ve0JW3iV15k4k4itEmDGAuJQEpNq | |
Resolving t.co (t.co)... 104.244.42.133, 104.244.42.197, 104.244.42.69, ... | |
Connecting to t.co (t.co)|104.244.42.133|:443... connected. | |
HTTP request sent, awaiting response... 301 Moved Permanently | |
Location: https://linkedin.com/slink?code=gcfcUq57 [following] | |
--2022-03-18 13:30:42-- https://linkedin.com/slink?code=gcfcUq57 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%Note on rotation: It may be a good idea to rotate the page when printing, | |
%so that the envelope is in a "portrait" orientation in the printer. | |
%I tried to use lscape to rotate the text, but that doesn't seem to work with textpos. | |
%The solution for now is to use an external tool like pdftk | |
%or the settings in some PDF viewers and printer drivers. | |
%Suggestions on how to achieve proper rotation in TeX are welcome. | |
%Settings | |
%Envelope dimensions (in inches) (US #10 envelopes are 9 1/2 in. x 4 1/8 in.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ENTROPY_BYTES=16 | |
dd if=/dev/urandom bs="$ENTROPY_BYTES" count=1 2> /dev/null | \ | |
base64 -w 0 | sed 's/=//g; s/+/-/g; s/\//_/g' | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This code is dedicated to the public domain under | |
# Creative Commons CC0 1.0 Universal <https://creativecommons.org/publicdomain/zero/1.0/> | |
import base64 | |
import json | |
import sys | |
import zlib | |
shc = input() |
NewerOlder