Skip to content

Instantly share code, notes, and snippets.

@sirodoht
sirodoht / Caddyfile
Last active March 10, 2024 18:43
Caddyfile for ollama with basic auth
# /etc/caddy/Caddyfile
api.example.com:443 {
route {
@options method OPTIONS
handle @options {
header Access-Control-Allow-Origin "https://clientwebsite.com"
header Access-Control-Allow-Methods "POST"
header Access-Control-Allow-Headers "authorization"
header Access-Control-Allow-Credentials true
@sirodoht
sirodoht / firefox-unregister-all-service-workers.js
Last active July 12, 2023 16:11 — forked from BookGin/firefox-unregister-all-service-workers.js
Unregister all service workers in Firefox.
// navigate to about:serviceworkers first
// then run:
for (let k of document.querySelectorAll("[data-l10n-id='unregister-button']")) k.click()
sudo apt update
sudo apt install -y vim git python3-dev gcc g++ make unzip tree python3.10-venv iftop ripgrep
sudo -v ; curl https://rclone.org/install.sh | sudo bash
mkdir -p ~/.config/rclone/
vim ~/.config/rclone/rclone.conf
# ~/.config/rclone/rclone.conf
[r2]
@sirodoht
sirodoht / emperor.uwsgi.service
Created November 1, 2022 19:43
uWSGI systemd entry for Ubuntu 20.04 — /etc/systemd/system/emperor.uwsgi.service
[Unit]
Description=uWSGI Emperor service
After=syslog.target
[Service]
ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi/emperor.ini
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all
@sirodoht
sirodoht / Makefile
Created September 6, 2022 04:55 — forked from ninjarobot/Makefile
Building nginx for macOS without homebrew
# default target so running 'make' by itself wll download and build nginx
build: nginx
cd nginx && ./configure --with-pcre=../pcre2 && make
nginx: pcre2
curl -O https://nginx.org/download/nginx-1.21.6.tar.gz
tar -xzvf nginx-*.tar.gz
mv nginx-*/ nginx
rm nginx-*.tar.gz
@sirodoht
sirodoht / lazygit-config.yml
Last active December 20, 2021 15:17
lazygit config macOS
# /Users/sirodoht/Library/Application Support/lazygit/config.yml
gui:
theme:
lightTheme: true
showFileTree: false
mouseEvents: false
skipStashWarning: false
showRandomTip: false
showCommandLog: false
@sirodoht
sirodoht / hosts
Created December 6, 2021 08:59
macOS 12 default /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
import os
from send2trash import send2trash
# get origin dir
photos_path = r"/Volumes/Leslie/G_processing/alltakeouts"
# index all origin files to a dict[filename] = path
log_filename = "json-files-to-delete.log"
log_file = open(log_filename, "w")
use std::time::Instant;
let before = Instant::now();
workload();
println!("Elapsed time: {:.2?}", before.elapsed());
@sirodoht
sirodoht / dokku-commands.sh
Last active October 31, 2020 16:51
Dokku config commands
# config with restart
dokku config:set mataroa SECRET_KEY=''
# config no restart
dokku config:set --no-restart mataroa EMAIL_HOST_USER=''
dokku config:set --no-restart mataroa EMAIL_HOST_PASSWORD=''
# run command
dokku run mataroa python manage.py createsuperuser --email zf@sirodoht.com --username sirodoht