Skip to content

Instantly share code, notes, and snippets.

View joekiller's full-sized avatar

Joseph Lawson joekiller

View GitHub Profile
@joekiller
joekiller / README.md
Created October 31, 2024 05:29
GPG TLDR; commands

Expire and update keys

$> gpg --edit-key <key-id>
gpg> key 1
(for subkey, ssb, just expire for key 0, sec)
gpg> expire
(follow prompts)
gpg> save
@joekiller
joekiller / README.md
Created October 10, 2023 14:58
Migrating macbooks

Some helpful commands:

on the old machine clean out caches and stuff

find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
find . -name '.pytest_cache' -type d -prune -exec rm -rf '{}' +
find . -name 'venv' -type d -prune -exec rm -rf '{}' +
find . -name '*x86_64*' -type d -prune -exec rm -rf '{}' +
find . -name 'cache' -type d -prune -exec rm -rf '{}' +
@joekiller
joekiller / 01_setup_raid.md
Last active September 25, 2023 00:44
raspberry pi nas/server
@joekiller
joekiller / strip.js
Last active September 28, 2022 05:40
Strip token secrets in javascript
/**
* Very useful for pumping through logs that you don't want to leak stuff.
* @param {string} [target] string to scrub
* @param {(string | RegExp)[]} tokens to be scrubbed, regex match or exact string match
*/
function scrubString(target, tokens) {
if(!target || !tokens || tokens.length === 0) {
return;
}
let scrubbed = target;
@joekiller
joekiller / a-readme.md
Last active November 19, 2023 23:07
example backpack.tf notification

Below are two notifications from the Backpack.tf websocket. One is a normal listing and the other is a Marketplace.tf listing.

Also attached is the logic for detecting a "postlife" spell. A postlife spell is an items that was only avaliable after spells were removed from the game however thought gitches it still got a spell.

@joekiller
joekiller / README.md
Last active October 17, 2023 12:25
TF2 Trade History

This is a program to scan though your steam trade history for TF2 Trades. you have to update in scanHistory.json on line 6 the target to match your steam id. so for me it's 76561197966563795 but you need to replace it with your steamID64, look it on on steamrep if you are unsure. and then you need to make a file in the same directory called .env.json that contains an object with your Steam API Key: https://steamcommunity.com/dev/apikey

Also this requires nodejs 14+. I run the program by running the command: node scanHistory.js.

You can use VSCode or other IDEs like Webstorm that can interpret JSON files to make this easy. It's kinda a cludge but it works. Basically it makes two files for trade history. the files are a date.json and date-details.json like 1321088897.json and 1323108997-details.json image

The way this works is it runs through all your trade history and then looks up all the

@joekiller
joekiller / README.md
Last active June 16, 2023 12:29
Updated craft hat skus
@joekiller
joekiller / BackpackSocketManager.ts
Created April 23, 2022 15:13
BackpackSocketManager
import ReconnectingWebSocket from 'reconnecting-websocket';
import WS from 'ws';
import * as Events from 'reconnecting-websocket/events';
export default class BackpackSocketManager {
private ws: ReconnectingWebSocket;
constructor() {
this.ws = new ReconnectingWebSocket('wss://ws.backpack.tf/events', [], {
WebSocket: WS,
@joekiller
joekiller / https.ts
Last active April 4, 2022 04:10
Nodejs Typescript Https get and post
import https from "https";
export async function httpsPost<T>(params: { hostname: string, path: string, headers: Record<string, any>, body?: string }): Promise<{ status: number, data: T | string }> {
let {path, hostname, body, headers} = params;
let options = {
hostname,
port: 443,
path,
method: 'POST',
headers
@joekiller
joekiller / index.d.ts
Created February 21, 2022 04:12
node-pushbullet-api v3.0 typescript types
declare module 'pushbullet' {
import { EventEmitter } from 'events';
import { Response } from 'node-fetch';
interface MakeRequestOptions<T> {
qs?: Record<string, string>
json?: T
}
export interface MeResponse {