Skip to content

Instantly share code, notes, and snippets.

@Ham5ter
Ham5ter / regenerate_ssh_host_keys_init.sh
Last active October 9, 2022 15:38
regenerate openssh-keys on first boot!
#!/bin/bash
#
# This Script Regenerates the OpenSSH Host Keys, and deletes itself afterwards!
# Put this Script in the "/etc/rc5.d/" directory.
#
# Version: 1.1
# Author: [email protected]
# Date 02.08.2016
# SPDX-License-Identifier: MIT
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@MicahZoltu
MicahZoltu / discord.js
Last active October 21, 2021 08:18
Reaction Hotkey for various chat clients.
window.addEventListener('keydown', event => {
if (!event.shiftKey || !event.ctrlKey || event.key != '|') return
const container = document.querySelector('main > div:first-of-type > div:first-of-type > div:first-of-type > ol > li:last-of-type > div')
container.dispatchEvent(new MouseEvent('mousemove', { bubbles: true }));
container.querySelector('div[aria-label="Add Reaction"]').click()
})
@gasman
gasman / encode.py
Created October 25, 2020 12:23
Encoding a file as a Youtube video - https://www.youtube.com/watch?v=hyqLv2_zBdA
# Encode inputfile.tar.gz as a series of video frames
# Frames are written to frames/frameNNNN.png
from PIL import Image
with open('inputfile.tar.gz', 'rb') as f:
data = f.read()
WIDTH = 120
HEIGHT = 90
CHUNK_SIZE = int((WIDTH * HEIGHT) / 8)
@artizirk
artizirk / nginx.conf
Last active November 13, 2024 01:46
Nginx config for scaling matrix synapse server via workers
# Matrix Synapse workers example config
# backends
upstream synapse_master {
server 192.19.18.12:38008;
}
upstream synapse_federation {
server 192.19.18.12:8083;
}