Skip to content

Instantly share code, notes, and snippets.

@hiorws
hiorws / cron-sendy-backup
Created September 16, 2020 14:44 — 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.
30 0 * * * root /usr/local/bin/sendy-backup > /dev/null 2>&1
@hiorws
hiorws / web-servers.md
Created July 28, 2020 12:02 — forked from willurd/web-servers.md
Big list of http static server one-liners

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 August 19, 2019 10:28
Processing High Resolution Output Generator Template
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 17:48 — forked from KdotJPG/OpenSimplex2S.java
Visually axis-decorrelated coherent noise algorithm based on the Simplectic honeycomb.
/*
* 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
@hiorws
hiorws / opencv_webcam_multithread.py
Created May 6, 2020 21:36 — forked from allskyee/opencv_webcam_multithread.py
opencv python camera frame grab and display on different threads with safe synchronization
#!/usr/bin/env python
from threading import Thread, Lock
import cv2
class WebcamVideoStream :
def __init__(self, src = 0, width = 320, height = 240) :
self.stream = cv2.VideoCapture(src)
self.stream.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, width)
self.stream.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, height)
@hiorws
hiorws / springer_books_download.sh
Created April 29, 2020 20:16
Spring Books Download
wget "https://link.springer.com/content/pdf/10.1007/978-1-4842-4932-1" -O "Programming Persistent Memory.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-981-15-2429-5" -O "Forensic Genetics in the Governance of Crime.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-981-13-8437-0" -O "Autistic Community and the Neurodiversity Movement.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-981-13-8491-2" -O "Updates on Myopia.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-3-030-41882-3" -O "Audacious Education Purposes.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-3-030-29509-7" -O "The Future of Software Quality Assurance.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-981-15-0749-6" -O "Understanding China’s School Leadership.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-981-15-3053-1" -O "Educational Change Amongst English Language College Teachers in China.pdf"
wget "https://link.springer.com/content/pdf/10.1007/978-3-03
@hiorws
hiorws / covid19-tmux-dashboard.md
Created April 3, 2020 14:41 — forked from p0bailey/covid19-tmux-dashboard.md
Covid19 Tmux Dashboard
@hiorws
hiorws / sonarqube-docker-compose.yml
Created February 17, 2020 11:09 — forked from Warchant/sonarqube-docker-compose.yml
docker-compose file to setup production-ready sonarqube
version: "3"
services:
sonarqube:
image: sonarqube
expose:
- 9000
ports:
- "127.0.0.1:9000:9000"
networks:
@hiorws
hiorws / OSC_C_01.rb
Created April 8, 2019 10:31 — forked from AlexandreRangel/OSC_C_01.rb
Controling Sonic Pi from Processing OSC
# reading OSC from Processing, Alexandre Enkerli
# full screen, fulltime mouse, Alexandre Rangel
# 24-Nov-2016
# Sonic Pi 2.11
use_bpm 120
set_sched_ahead_time! 0 # Setting that one to a negative value makes Sonic Pi complain, it sounds like.
live_loop :osc do # The loop is inside the fx as this is where the action will be.
osc=sync "/osc" # The OSC message which Processing sends, based on mouse coordinates.
@hiorws
hiorws / gist:50776cc72e8d884c8480fe42238e3070
Created August 10, 2016 11:01
Python AES two-way encryption/decryption example
from Crypto.Cipher import AES
import base64
import os
# the block size for the cipher object; must be 16, 24, or 32 for AES
BLOCK_SIZE = 32
# the character used for padding--with a block cipher such as AES, the value
# you encrypt must be a multiple of BLOCK_SIZE in length. This character is
# used to ensure that your value is always a multiple of BLOCK_SIZE