Skip to content

Instantly share code, notes, and snippets.

@ChrisSwanson
ChrisSwanson / leetsolves.py
Last active February 18, 2024 10:03
blind-75-leetsolves
#!/usr/bin/env python3
import os
problems = {
"problems": {
"Array": {
"two-sum": {
"name": "Two Sum",
"premium": False,
@ChrisSwanson
ChrisSwanson / .env.example
Created September 7, 2023 19:34
Golang Github Private Repo docker-compose
GITHUB_USER=user
GITHUB_TOKEN=github_pat_abcdefghijklmnopqrstuvwxyz0123456789
@ChrisSwanson
ChrisSwanson / docker-compose.yml
Created April 4, 2023 01:24
changedetection.io playwright chrome docker compose
version: "3.8"
services:
changedetection:
container_name: changedetection
hostname: changedetection
image: ghcr.io/dgtlmoon/changedetection.io:latest
environment:
- TZ=America/Los_Angeles
- PLAYWRIGHT_DRIVER_URL=ws://playwright-chrome:3000/?stealth=1&--disable-web-security=true&token=<redacted>
@ChrisSwanson
ChrisSwanson / .bashrc
Created March 25, 2023 20:44
oscp shortcuts
alias ssh='ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no"'
@ChrisSwanson
ChrisSwanson / multi.py
Last active January 28, 2023 22:48
python3 multiprocessing example
#!/usr/bin/env python3
import multiprocessing
import random
import time
class Worker(multiprocessing.Process):
@ChrisSwanson
ChrisSwanson / sec_forms.json
Last active November 17, 2022 05:39
SEC Form Filings JSON
[
{
"form": "1",
"description": "Application for registration or exemption from registration as a national securities exchange (PDF)",
"last_updated": "Feb 1999",
"sec_number": "SEC1935",
"topics": [
"Self-Regulatory Organizations"
]
},
@ChrisSwanson
ChrisSwanson / lazy_venv.sh
Created August 6, 2022 18:04
automatically activate/deactivate virtualenv if venv in local dir
# automate sourcing virtualenv if venv dir in local dir.
function cd() {
builtin cd "$@"
if [[ -z "$VIRTUAL_ENV" ]] ; then
## If venv folder is found then activate the vitualenv
if [[ -d ./venv ]] ; then
source ./venv/bin/activate
fi
else
@ChrisSwanson
ChrisSwanson / dotenv_to_dockerenv.sh
Created June 1, 2022 23:45
.env to Docker ENV oneliner
#!/usr/bin/bash
cat .env | awk -F"\=" '{ print $1 }' | grep -v -e '^$' | while read line; do echo "ENV $line=\"\""; done
@ChrisSwanson
ChrisSwanson / aws_regions_json.sh
Created November 20, 2021 21:48
AWS Regions JSON oneliner
# requires pup, and jq to be installed
# this is likely to break based on the css selector, but a quick hack for now.
curl "https://docs.aws.amazon.com/general/latest/gr/rande.html" | pup "#w420aac12b7b9c13 > tbody > tr json{}" | jq '.[].children | { region: .[1].text, name: .[0].text} ' | sed -e '$!s/"$/",/' | sed -e 's/}/},/'
@ChrisSwanson
ChrisSwanson / macos_voices.sh
Created September 14, 2021 14:58
Listen and Test Mac Voices
#!/bin/bash
# say -v ? lists the voices available
for voice in $(say -v ? | awk '{ print $1 }')
do
echo "==> ${voice}"
say -v $voice "hello this is ${voice}"
sleep 1
done