Skip to content

Instantly share code, notes, and snippets.

Avatar

Joseph Lawson joekiller

View GitHub Profile
@joekiller
joekiller / strip.js
Last active September 28, 2022 05:40
Strip token secrets in javascript
View strip.js
/**
* 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 February 9, 2023 16:11
example backpack.tf notification
View a-readme.md

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 / .env.json
Last active July 30, 2022 14:36
TF2 Trade History
View .env.json
{
"key": "ABC123"
}
@joekiller
joekiller / README.md
Last active May 30, 2023 12:07
Updated craft hat skus
View README.md

via Sangria Craft hat sku list https://pastebin.com/raw/qTc9Xd9Y

Updates

=======

5/30/2023

added

  • The Bone Dome 30162;6
  • Employee of the Mmmph 30416;6
  • The Burning Bandana 30091;6
@joekiller
joekiller / BackpackSocketManager.ts
Created April 23, 2022 15:13
BackpackSocketManager
View BackpackSocketManager.ts
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
View https.ts
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
View index.d.ts
declare module 'pushbullet' {
import { EventEmitter } from 'events';
import { Response } from 'node-fetch';
interface MakeRequestOptions<T> {
qs?: Record<string, string>
json?: T
}
export interface MeResponse {
@joekiller
joekiller / get.ts
Created December 7, 2021 23:55
https.get typescript nodejs
View get.ts
const data: string = await new Promise((resolve, reject) => {
https.get(targetUrl, (res) => {
res.setEncoding('utf8');
let rawData = '';
res.on('data', (chunk) => {
rawData += chunk;
});
res.on('end', () => {
try {
resolve(rawData);
@joekiller
joekiller / device-farm-action.ts
Last active November 19, 2021 22:15
AWS CDK Device Farm Action for CodePipeline
View device-farm-action.ts
import codepipeline = require('@aws-cdk/aws-codepipeline');
import iam = require('@aws-cdk/aws-iam');
import cdk = require('@aws-cdk/core');
import { ActionCategory } from '@aws-cdk/aws-codepipeline';
import { Action } from '@aws-cdk/aws-codepipeline-actions';
/**
* The OS and type of application you are testing.
*/
export enum DeviceFarmAppType {
@joekiller
joekiller / raw_stack.py
Created October 28, 2019 12:51
aws-cdk migrate RawStack to CDK
View raw_stack.py
import yaml
from aws_cdk import core
class RawStack(core.Stack):
def __init__(self, scope: core.Construct, name: str, template_path: str, wrapped_parameters=None,
**kwargs) -> None:
"""import a stack off a path and munge in ssm variables if desired
:param template_path: path to raw stack being imported
:param wrapped_parameters: map of Parameter keys and default values