This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Three ways to control a docker container remotely from another docker container or host: Python, SSH, or ncat/nc/socat. | |
# | |
# Useful if you have two containers in a Docker Compose project and you want | |
# container1 to be able to run commands in container2 without having to share /var/run/docker.sock | |
# | |
# Further Reading: https://www.revshells.com/#bind | |
### 1. Using pure Python, the cleanest option | |
# supports dbus/x11/etc as it doesnt spawn a new login shell, correctly handles exiting after finished commands without hacky workarounds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Script to extract song/video title, artist, album, etc. metadata from screenshots w/ GPT-4. | |
### Example Usage: ############################################################################### | |
# | |
# ➜ ~/Desktop # python3 music_in_screnshots.py --prompt=prompt.txt --attach=spotify_screenshot.PNG | |
# { | |
# "found_prominent_media": true, | |
# "all_strings": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# imgur_backup.sh | |
# Backup all Imgur URLs found in a given directory using ripgrep + wget. Searches all text files, binary files, PDFs, database dumps, etc. for any imgur URLs and downloads them into a local directory. | |
# | |
# Note: make sure you apt/brew install ripgrep first, and replace grep with ggrep (brew install grep) on macOS | |
# Usage: | |
# | |
# $ mkdir db_dumps | |
# $ docker-compose exec postgres env PGPASSWORD=somepassword pg_dump -U someuser somedb > ./db_dumps/db_dump.sql | |
# $ bash imgur_backup.sh db_dumps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# U2F SSH key generation and installation guide | |
# | |
# install U2F libraries on client machine | |
sudo apt-get install pamu2fcfg libpam-u2f | |
# | |
# Currently, there are only two ciphers that support | |
# 'special keys' or (sk) this is the notation in the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2021 Daniel Ethridge | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# asymptotic_progress_bar.py | |
# MIT License © 2021 | |
# | |
# A pretty non-blocking python progress bar timer that fills up asymptotically until you stop it. | |
# Good for when you don't know how long a task is going to take (up to some max timeout), | |
# but you want it to feel fast and accurate / not stuck the whole time. | |
# ████████████████████ 0.9% (1/60sec) | |
# useful for animating e.g. file copy progress, download progress, package install progress, etc. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load tz %} | |
<html> | |
<head> | |
<script> | |
{% get_current_timezone as TIME_ZONE %} | |
window.TIME_ZONE = '{{TIME_ZONE}}' // timezone server thinks we're in | |
function setCookie(name, value, days) { | |
let expires = "" | |
if (days) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspiration from here: https://tutti.me/post/5453/ | |
# Or you can use a library like: | |
# - https://github.com/adamcharnock/django-tz-detect (last updated 2019) | |
# - https://github.com/Miserlou/django-easy-timezones (last updated 2016) | |
# - https://github.com/jamesmfriedman/django-easytz (last updated 2015) | |
# Or guess TZ using visitors IP GEOIP: https://codereview.stackexchange.com/questions/161261/set-time-zone-from-cookie | |
# settings.py | |
TEMPLATES = [{ |
NewerOlder