Skip to content

Instantly share code, notes, and snippets.

@ChrisSwanson
ChrisSwanson / update-containers.sh
Created September 14, 2024 01:41
Lazy Cron Update docker containers
#!/bin/bash
# Navigate to the directory containing the docker-compose.yaml file
cd /path/to/docker-compose.yaml || exit
# Pull the latest images for all services
docker-compose pull
# Get the list of services from the docker-compose file
services=$(docker-compose config --services)
@ChrisSwanson
ChrisSwanson / gist:67463b522de4f4668ad8746498fff767
Created September 10, 2024 16:12
all docker root directories
# bash one liner for listing all root directories where containers are being run from
docker ps | awk '{ print $1 }' | tail -n +2 | xargs -n1 docker container inspect $container | jq -r '.[].Config.Labels."com.docker.compose.project.config_files"' | sort | uniq
@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