Skip to content

Instantly share code, notes, and snippets.

@lloesche
lloesche / migrate.sh
Last active June 3, 2019 18:51
Backup/Restore DC/OS Services and Jobs from one cluster to another in a suspended state
CLUSTER_A=olddcos
CLUSTER_B=newdcos
# BACKUP SERVICES
dcos cluster attach $CLUSTER_A
curl -H "Authorization: token=$(dcos config show core.dcos_acs_token)" $(dcos config show core.dcos_url)/service/marathon/v2/apps | \
jq '.[] | del(.[].version) | del(.[].uri) | del(.[].versionInfo) | del(.[].tasksStaged) | del(.[].tasksRunning) | del(.[].tasksHealthy) | del(.[].tasksUnhealthy) | del(.[].deployments)' > apps.json
for id in $(jq -r '.[] | "\(.id)"' apps.json); do cleanid="${id//\//_}"; jq ".[] | select(.id==\"$id\") | .instances=0" apps.json > service.${cleanid:1}.json; done
# BACKUP JOBS
@lloesche
lloesche / nvmelink.py
Created April 17, 2018 14:33
Create symlinks for AWS EC2 nvme devices
@lloesche
lloesche / gist:a99e9e487f7bdc3b59c14c2c5ee4a25d
Created June 27, 2017 11:30
Testing our Github credential leakage scanner
[default]
aws_access_key_id = AKIAJQATOQGMX2TOF1CX
aws_secret_access_key = I3rNML6Nl0vPbh0CuQdqSQ3LB5kHYAaBrWd+VEho
(these are invalid credentials)
Dockerfile:
FROM alpine:edge
CMD ["Hello World"]
ENTRYPOINT ["echo"]
{
"id": "/marathon-test",
"instances": 1,
"container": {
# Create your CA crt and key:
openssl req -new -x509 -nodes -newkey rsa:4096 -extensions v3_ca -sha256 -days 3650 -subj "/C=US/ST=CA/L=San Francisco/O=Acme Inc./CN=Acme Insecure Certificate Authority" -keyout ca.key -out ca.crt
chmod 600 ca.key
# Create a CSR:
openssl req -newkey rsa:2048 -nodes -sha256 -keyout cert.key -out cert.csr -subj "/C=US/ST=CA/L=San Francisco/O=Snakeoil Inc./OU=Core/CN=lobotomat.de"
# Check contents of CSR (optional):
openssl req -in cert.csr -text -noout
@lloesche
lloesche / update-network-folder-view.scpt
Created May 31, 2016 08:12
Update OSX Finder View (refreshes changed content on network/smb shares)
tell application "Finder" to tell front window to update every item
@lloesche
lloesche / tox265.sh
Created March 13, 2016 22:07
encode input file to hevc
#!/bin/bash
set -euo pipefail
infile="$1"
preset=veryfast
audiobitrateperchannel=64
ffmpeg_docker='lloesche/nginx-fatpack'
originfile=$infile
[ ! -f "$infile" ] && \
echo "file $infile not found" && \
#!/bin/bash
set -e -o nounset -o pipefail
# Credentials for user EBSbackup
# with inline policy that allows:
# ec2:CreateSnapshot
# ec2:CreateTags
# ec2:DeleteSnapshot
# ec2:DescribeSnapshots
# ec2:DescribeVolumes
#!/bin/bash
dnf install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/yasm/yasm.git
cd yasm
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
When reloading haproxy too fast on EL7 (RedHat, CentOS) the system is
being filled with orphaned processes.
I encountered this problem on CentOS 7 with
haproxy-1.5.4-4.el7_1.x86_64 but expect it to exist on all systems
using haproxy-systemd-wrapper not just those based on Fedora.
Steps to reproduce:
1) haproxy is running normal.