Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View wouterds's full-sized avatar
:octocat:
Hello world!

Wouter De Schuyter wouterds

:octocat:
Hello world!
View GitHub Profile
@wouterds
wouterds / backup.sh
Last active March 25, 2021 12:28
rsync backup script
#!/bin/sh
RSYNC="/usr/bin/sudo /usr/bin/rsync"
DTIME=`date +"%Y%m%d"`
LOCATION=/mnt/backups/servers/$1/$DTIME
mkdir -p $LOCATION
rsync -avx \
--rsync-path="$RSYNC" \
@wouterds
wouterds / mysql-docker.sh
Created February 6, 2021 10:57 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# 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
@wouterds
wouterds / gist:fd548d3400d79bce47be87def9857739
Created November 6, 2020 09:01
Cache static assets served from node container for a year
location ~ \.(?:ico|css|js|gif|jpe?g|png|webp|gif|svg|txt)$ {
proxy_pass http://node:3000;
proxy_hide_header Cache-Control;
add_header Cache-Control "public, max-age=31536000, immutable";
}
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'react',
'react-hooks',
'prettier',
],
extends: [
@wouterds
wouterds / m3u8-to-mp4.md
Created March 20, 2020 07:27 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
This method also works with wireless doorbells and other similar systems.
We're gonna need a RTL-SDR, which is basically a radio dongle and a cheap radio transmitter.
We will also need a microcontroller to interface with the transmitter, any Arduino would do it.
You can get one for less than 8$ on Ebay, a 433MHz radio transmitter for less than 1$ and any kind of arduino clone for less than 3$.
Let's start...
First you need to install the drivers for the RTL-SDR, the Arduino IDE if you don't already have it,
the Audacity Audio Analyser/Editor and finally a spectrum analyzer, you can use http://airspy.com/?ddownload=3130 SDR# or https://github.com/pothosware/pothos/wiki/Downloads GQRX in Windows and https://github.com/pothosware/pothos/wiki/Downloads GQRX on linux.
@wouterds
wouterds / useAppState.ts
Created February 22, 2020 17:09
React Native useAppState hook
import { useState, useEffect, useCallback } from 'react';
import { AppState, AppStateStatus } from 'react-native';
const useAppState = () => {
const [appState, setAppState] = useState(AppState.currentState);
const handleAppStateChange = useCallback(
(nextAppState: AppStateStatus) => {
setAppState(nextAppState);
},
[setAppState],
version: "3.3"
services:
server01:
image: containous/whoami
container_name: service
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.whoami-http.rule=Host(`service.server.com`)"
version: "3.3"
services:
traefik:
image: traefik:2.1
container_name: reverse-proxy
command:
- "--api.insecure=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
@wouterds
wouterds / docker-compose.yml
Created February 9, 2020 11:14
Traefik reverse proxy with letsencrypt & auto forwarding of http to https
version: "3.3"
services:
traefik:
image: traefik:2.1
container_name: reverse-proxy
command:
- "--api.insecure=true"
- "--providers.docker=true"