Skip to content

Instantly share code, notes, and snippets.

@hiorws
hiorws / init.sh
Last active Jul 17, 2021 — forked from m-radzikowski/script-template.sh
Ubuntu 20.04 Server Initialization Script includes Docker & Docker Compose Installation
View init.sh
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
DOCKER_COMPOSE_VERSION=1.27.4
usage() {
cat <<EOF
@hiorws
hiorws / face-detection.py
Created May 12, 2020 — forked from bookjan/face-detection.py
Using python opencv to detect face and send the frames to FFmpeg to create HLS(HTTP Live Streaming)
View face-detection.py
import numpy as np
import cv2
import sys
cap = cv2.VideoCapture(0)
face_cascade = cv2.CascadeClassifier('<PATH_TO_CASCADES_FOLDER>/haarcascade_frontalface_default.xml')
while(True):
# Capture frame-by-frame
@hiorws
hiorws / sketch_hires_lores.pde
Last active Dec 13, 2020 — forked from jorgenys/sketch_hires_lores.pde
High resolution rendering with Processing, Part 2
View sketch_hires_lores.pde
PGraphics render;
int printWidth = 10;
int printHeight = 6;
int printDpi = 300;
int previewDpi = 72;
boolean renderHighRes = false;
boolean firstFrame = true;
@hiorws
hiorws / Vault-ssh-ca-README.md
Created Dec 10, 2020 — forked from kawsark/Vault-ssh-ca-README.md
A guide for configuring Vault's SSH-CA
View Vault-ssh-ca-README.md

SSH CA use-case with Vault

In this scenario we are going to set up Vault to sign SSH keys using an internal CA. We will configure the SSH secrets engine and create a CA within Vault. We will then configure an SSH server to trust the CA key we just created. Finally we will attempt to SSH using a private key, and a public key signed by Vault SSH CA.

Prerequisites

  • This guide assumes you have already provisioned a Vault server, SSH host using OpenSSH server, and a SSH client machine.
  • The client system must be able to reach the Vault server and the OpenSSH server.
  • We will refer to these systems respectively as:
    • VAULT_SERVER
@hiorws
hiorws / mysql-docker.sh
Created Oct 16, 2020 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
View mysql-docker.sh
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
View Remove Sophos from Mac without tamper protection password.md
cd /Library/Preferences
sudo rm com.sophos.sav.plist

cd /Library/Application\ Support/Sophos/cloud/Installer.app/Contents/MacOS/tools/
sudo ./InstallationDeployer —force_remove
@hiorws
hiorws / cron-sendy-backup
Created Sep 16, 2020 — forked from nickjj/cron-sendy-backup
An example of creating a database backup and restore script for MySQL, MariaDB and PostgreSQL. It is focused on backing up and restoring a Sendy database (working example from https://www.youtube.com/watch?v=kbCytSYPh0E) but you can apply it for any database with slight modifications.
View cron-sendy-backup
30 0 * * * root /usr/local/bin/sendy-backup > /dev/null 2>&1
@hiorws
hiorws / web-servers.md
Created Jul 28, 2020 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@hiorws
hiorws / PrintTemplate.pde
Created Aug 19, 2019
Processing High Resolution Output Generator Template
View PrintTemplate.pde
import processing.pdf.*;
/*
* Processing High Resolution Output Generator Template
* Taken from:
* http://sighack.com/post/exporting-high-resolution-images-in-processing
* Thanks to: @sighack
*/
int seed;
@hiorws
hiorws / OpenSimplexNoise.java
Created May 23, 2020 — forked from KdotJPG/OpenSimplexNoise.java
Visually axis-decorrelated coherent noise algorithm based on the Simplectic honeycomb.
View OpenSimplexNoise.java
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* v1.1 (October 5, 2014)
* - Added 2D and 4D implementations.
* - Proper gradient sets for all dimensions, from a
* dimensionally-generalizable scheme with an actual
* rhyme and reason behind it.
* - Removed default permutation array in favor of