Skip to content

Instantly share code, notes, and snippets.

View ObjectBoxPC's full-sized avatar

Philip Chung ObjectBoxPC

View GitHub Profile
@ObjectBoxPC
ObjectBoxPC / direct-password-input-treasurydirect.user.js
Last active October 23, 2023 09:02
Userscript to enable direct password input on TreasuryDirect login
// ==UserScript==
// @name Enable Direct Password Input on TreasuryDirect
// @version 1
// @include https://www.treasurydirect.gov/*
// @grant none
// ==/UserScript==
document.querySelector('input.pwordinput').readOnly = false;
@ObjectBoxPC
ObjectBoxPC / phishingurl.txt
Last active March 19, 2022 00:45
Analysis of a URL in an Amazon phishing e-mail
# 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
@ObjectBoxPC
ObjectBoxPC / envelope.tex
Created January 30, 2022 10:23
XeLaTeX template document for printing addresses on envelopes
%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.)
@ObjectBoxPC
ObjectBoxPC / makepassword.sh
Last active August 15, 2024 06:38
Quickly generate random passwords using built-in utilities (emulating Python's secrets.token_urlsafe: https://gist.github.com/ObjectBoxPC/89206ca79bb26fdc2112233ede121d9d )
#!/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
@ObjectBoxPC
ObjectBoxPC / shc.py
Last active January 4, 2022 09:03
Dump payload from a SMART Health Card https://smarthealth.cards/
# 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()
@ObjectBoxPC
ObjectBoxPC / StrConv.hs
Created May 31, 2021 09:50
Programs to transform text strings
module StrConv (strConv, charify) where
import System.Environment
import System.Exit
import Data.Char
convertStr convertChar = map $ \c -> case convertChar c of
Just converted -> converted
_ -> c
@ObjectBoxPC
ObjectBoxPC / califblueprintcovid19.hs
Created May 31, 2021 09:33
Functions implementing California's COVID-19 reopening tiers introduced in August 2020 (not including 2021 updates) https://www.cdph.ca.gov/Programs/CID/DCDC/Pages/COVID-19/COVID19CountyMonitoringOverview.aspx
data RiskTier = Widespread | Substantial | Moderate | Minimal
deriving (Show, Eq)
instance Ord RiskTier where
compare x y = compare (tierNumber x) (tierNumber y)
where
tierNumber t = case t of
Widespread -> 1
Substantial -> 2
Moderate -> 3
@ObjectBoxPC
ObjectBoxPC / makepassword.py
Created May 24, 2021 21:58
Quickly generate random passwords
#!/usr/bin/env python3
import secrets
entropy_bytes = 16
print(secrets.token_urlsafe(entropy_bytes))
@ObjectBoxPC
ObjectBoxPC / andref.cpp
Last active September 5, 2024 22:13
Misusing C++ alternative tokens
#include <utility>
class my_class {
public:
compl my_class() {} // Destructor
};
int main() {
my_class example_obj;
my_class bitand example_ref = example_obj;
@ObjectBoxPC
ObjectBoxPC / shell_start.c
Created November 28, 2020 06:12
Simple program start a shell based on certain inferences (mainly to learn some POSIX C programming)
#include <unistd.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <stddef.h>
/**
* @file
* Utility function to start a shell based on reasonable inferences
*/