Skip to content

Instantly share code, notes, and snippets.

View jkereako's full-sized avatar

Jeff Kereakoglow jkereako

View GitHub Profile
@jkereako
jkereako / taxslayer.go
Created February 22, 2025 17:43
Convert a Fidelity CSV to a TaxSlayer CSV for import
// Generated by Copilot
package main
import (
"bufio"
"encoding/csv"
"fmt"
"os"
"strconv"
"strings"
@jkereako
jkereako / set_system_proxy.py
Last active February 26, 2025 14:37
Automatically toggle device proxies when mitmproxy starts and stops.
# Written by GitHub Copilot
#
# Automatically sets the system proxies for HTTP and HTTPS to 127.0.0.1:8080
#
# This only works on on macOS
import subprocess
from mitmproxy import ctx
class SetSystemProxy:
def __init__(self):
import Foundation
import XCTest
final class STDOUTListener {
/// Consume messages sent to STDOUT
let input = Pipe()
/// Sends messages back to STDOUT
let output = Pipe()
import Foundation
/// Synchronously wait for an asynchronous task.
///
/// Use this is if you need to execute an asynchronous task in a synchronous
/// context _and_ the result from the asynchronous task is needed before
/// execution can proceed.
func synchronouslyWait(for closure: @escaping @Sendable () async -> Void, timeout: TimeInterval = 2) {
let group = DispatchGroup()
@jkereako
jkereako / oauth-rfc.md
Last active April 19, 2024 13:21
OAuth RFCs

I couldn't keep track of all the RFCs related to OAuth. So here they are.

OAuth 2.0 RFCs

  1. [The OAuth 2.0 Authorization Framework][1]
  2. [Proof Key for Code Exchange by OAuth Public Clients][2]
  3. [OAuth 2.0 for Native Apps][3]
  4. [OAuth 2.0 Device Authorization Grant][4]

These RFCs underly the OAuth.

  1. [JSON Web Token (JWT)][5]
@jkereako
jkereako / Hash.swift
Last active January 12, 2024 17:25
Hashing in Swift
import CryptoKit
/// Hashes a string and returns it as a string.
func hash(_ string: String) -> String {
guard let data = string.data(using: .utf8) else { return "null" }
return SHA256
.hash(data: data)
.map { String(format: "%02x", $0) }
@jkereako
jkereako / ip.sh
Last active October 18, 2023 13:58
Prints the current SSID name and the local and public IP addresses
#!/usr/bin/env bash
#
# ip
#
# Shows the local and public IP addresses
set -Eeuo pipefail
# Print out error messages to STDERR.
function err() {
@jkereako
jkereako / resetxc.sh
Last active November 8, 2023 15:09
Reset Xcode
#!/usr/bin/env bash
#
# resetxc
#
# Kills Xcode, deletes all caches and build artifacts and re-opens Xcode
set -Eeuo pipefail
# Print out error messages to STDERR.
function err() {
@jkereako
jkereako / NetworkClient.swift
Last active October 18, 2023 13:21
Networking
import Foundation
public enum HTTPMethod: String {
case get = "GET"
case post = "POST"
case put = "PUT"
case delete = "DELETE"
}
public enum NetworkError: Error {
@jkereako
jkereako / replace-links.js
Last active June 17, 2022 21:35
Replace tokenized links with query string arguments.