Skip to content

Instantly share code, notes, and snippets.

@philroche
philroche / transmission-openvpn.syno.json
Created November 7, 2019 11:10
Docker config for Synology NAS for docker-transmission-openvpn docker image by haugene (https://github.com/haugene/docker-transmission-openvpn). This config is for Private Internet Access. Also see https://haugene.github.io/docker-transmission-openvpn/synology-nas/ for full guide.
{
"cap_add" : null,
"cap_drop" : null,
"cmd" : "dumb-init /etc/openvpn/start.sh",
"cpu_priority" : 50,
"devices" : null,
"enable_publish_all_ports" : false,
"enable_restart_policy" : false,
"enabled" : false,
"env_variables" : [
@philroche
philroche / Get the URL to the RTE player video.bookmarklet
Last active May 13, 2019 15:01
Get the URL to the RTE player video
javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3Bfunction%20callback()%7Bfunction%20getParameterByName(name%2C%20url)%20%7Bif%20(!url)%20url%20%3D%20window.location.href%3Bname%20%3D%20name.replace(%2F%5B%5C%5B%5C%5D%5D%2Fg%2C%20'%5C%5C%24%26')%3Bvar%20regex%20%3D%20new%20RegExp('%5B%3F%26%5D'%20%2B%20name%20%2B%20'(%3D(%5B%5E%26%23%5D*)%7C%26%7C%23%7C%24)')%2Cresults%20%3D%20regex.exec(url)%3Bif%20(!results)%20return%20null%3Bif%20(!results%5B2%5D)%20return%20''%3Breturn%20decodeURIComponent(results%5B2%5D.replace(%2F%5C%2B%2Fg%2C%20'%20'))%3B%7Dvar%20video_embed_url%20%3D%20getParameterByName(%22pid%22%2C%20%24(%22%23playerpdk%22).attr(%22src%22))%3Bvar%20auth_cookie%20%3D%20Cookies.get('mpx_token')%3Bvar%20auth_video_embed_url%20%3D%20video_embed_url%20%2B%20'%3Fauth%3D'%20%2B%20auth_cookie%20%2B'%26formats%3Dmpeg-dash%26format%3DSMIL%26embedded%3Dtrue%26tracking%3Dtrue'%3Bconsole.log(auth_video_embed_url)%3Bprompt(%22Video%20embed%20URL%20for%20use%20with%20https%3A%2
#!/bin/bash -e
## Launch the latest daily Ubuntu in AWS, optionally with user-data
## provided in a file and tagged with a name
function usage() {
echo "$0: [-r region] [-V ubuntu_version] [-i instance_type] \\"
echo " [-u user_data_file] [-n instance_name] [-d disk_size] \\"
echo " [-D] to disable termination via the API"
echo " [-I] iam instance profile [-a AMI ID]"
echo " [-P profile] aws cli profile"
@philroche
philroche / s3_presigned_url.py
Created October 16, 2018 07:16 — forked from rcj4747/s3_presigned_url.py
Generate a presigned URL to download an S3 object
#!/usr/bin/env python3
"""Generate a presigned URL to download an S3 object
<cmd> bucket_name key_name [expiration_days]"""
import sys
import boto3
from botocore.client import Config
@philroche
philroche / azure-sas-url-and-image-test.sh
Created September 28, 2018 11:39
Script for publishing, booting and gathering logs from a locally produced Azure image
#!/bin/bash
## Pass local .tar.gz path as first argument
# Update the following variables
# This will be created if it does not exist
ACCOUNT_NAME="philrocheubuntu"
# This will be created if it does not exist
CONTAINER="philrocheubuntuimages"
# Customize this as all vm resouces with this group will be cleaned up. This will be created if it does not exist
@philroche
philroche / recursive-m4a-convert-to-mp3.sh
Created April 11, 2018 11:55
Recursive convert m4a files to mp3
#!/bin/bash
#
#
#set -ux
set +e
if [ -z "$1" ] ; then
TRANSCODEDIR="."
else
TRANSCODEDIR="$1"
fi
@philroche
philroche / zncbackup.sh
Created February 13, 2018 10:44
Backup ZNC config and chat logs
#!/bin/bash
### Facultatif change :
DIR=/data/znc # This will most likely change for you
TAR_PATH=`whereis tar | cut -d ' ' -f 2`
p7zip_PATH=`whereis 7za | cut -d ' ' -f 2`
DATEI1=$(date +%Y-%m-%d)_znc_backup.tar
DATEI2=$(date +%Y-%m-%d)_znc_backup.tar.7z
DATUM=$(date +%Y-%m-%d)
sevenzp="a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on -mhe=on"
### no Change after here
@philroche
philroche / recursive-m4v-convert.sh
Last active November 8, 2018 17:42
Recursively convert all files using HandbrakeCLI and save to new folder.
#!/bin/bash
#
# Change this to specify a different handbrake preset. You can list them by running: "HandBrakeCLI --preset-list"
#
#set -ux
set +e
PRESET="Very Fast 720p30" # or Fast 720p30 or Fast 1080p30
if [ -z "$1" ] ; then
TRANSCODEDIR="."
else
@philroche
philroche / private_ppa_addition.sh
Created January 27, 2018 11:53 — forked from rcj4747/private_ppa_addition.sh
Add a package from a private PPA to a chroot and strip references to the private PPA
REPO_LINE="deb https://${LP_USER}:${PPA_PASSWORD}@${PRIVATE_PPA_URL} ${SUITE} main"
REPO_KEY_FINGERPRINT=832749327429CADB77842973ED72947203471037
# Add the private ppa to the system
env DEBIAN_FRONTEND=noninteractive chroot "${MOUNTPOINT}" apt-add-repository "${REPO_LINE}"
env DEBIAN_FRONTEND=noninteractive chroot "${MOUNTPOINT}" apt-key adv --keyserver keyserver.ubuntu.com --recv ${REPO_KEY_FINGERPRINT}
env DEBIAN_FRONTEND=noninteractive chroot "${MOUNTPOINT}" apt-get update
# Install from private PPA HERE
env DEBIAN_FRONTEND=noninteractive chroot "${MOUNTPOINT}" apt-get install -qqy awesome_package_but_super_secret
@philroche
philroche / instance-types.sh
Last active September 25, 2018 04:52 — forked from trestletech/instance-types.sh
Get all EC2 Instance Types in All Availability Zones
#!/bin/bash
echo "Getting list of Availability Zones"
all_regions=$(aws ec2 describe-regions --output text --query 'Regions[*].[RegionName]' | sort)
all_az=()
while read -r region; do
az_per_region=$(aws ec2 describe-availability-zones --region $region --query 'AvailabilityZones[*].[ZoneName]' --output text | sort)
while read -r az; do
all_az+=($az)