Skip to content

Instantly share code, notes, and snippets.

View tolleiv's full-sized avatar

Tolleiv Nietsch tolleiv

  • Bare.ID Gmbh - an AOE Group company
  • Wiesbaden, Deutschland
View GitHub Profile
import UIKit
class CustomPageViewController: UIPageViewController,UIPageViewControllerDataSource,UIPageViewControllerDelegate {
fileprivate lazy var pages: [UIViewController] = {
return [
self.getViewController(withIdentifier: "firstVc"),
self.getViewController(withIdentifier: "secondVc")
]
}()
@tolleiv
tolleiv / cap.py
Last active April 15, 2018 09:14
Fixed syntax and added documentation for the timelapse script from https://reps.cc/?p=85
#!/usr/bin/env python
import numpy as np
import cv2
from skimage.measure import compare_ssim as ssim
import time
# Pick a source - either a file or a (exiting) device
cap = cv2.VideoCapture('/dev/video0')
@tolleiv
tolleiv / gittosvn.sh
Created June 15, 2016 09:44
Some notes taken when we had to push a Git Repo to SVN
# http://caiustheory.com/adding-a-remote-to-existing-git-repo
git svn init -t tags -T trunk https://<svn-repo>/
git svn fetch
git remote add origin http://<git-repo>.git
git pull
svnCommit=`git show-ref trunk | awk '{print $1}'`
gitCommit=`git log --pretty=oneline master | tail -n1 | awk '{print $1}'`
echo "${gitCommit} ${svnCommit}" >> .git/info/grafts
git merge remotes/origin/master
git svn dcommit
@tolleiv
tolleiv / ssh_config
Created January 12, 2018 10:19
SSH Config so "ssh ip.aws" uses the right key with the right settings
Host *.aws
IdentityFile ~/.ssh/super-secret-key.pem
User ubuntu
StrictHostKeyChecking no
ProxyCommand nc $(sed -e "s/.aws$//" <<< "%h") %p
@tolleiv
tolleiv / letsencrypt_2017.md
Last active November 3, 2017 08:43 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

#!/bin/sh
SITE=example.org
openssl s_client -connect $SITE:443 > /tmp/cert (edited)
sudo keytool -storepass changeit -import -alias $SITE -keystore $(/usr/libexec/java_home)/jre/lib/security/cacerts -file /tmp/cert
@tolleiv
tolleiv / abort-jenkins-job.groovy
Created July 25, 2017 09:40
Groovy snippet to abort a build without removing it....
Jenkins.instance.getItemByFullName("JobName").getBuildByNumber(JobNumber).finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));
set -e # Fail fast
DISTRIBUTION_ID=xxxxxxxxxxxxxxxx
BUCKET_NAME=xxxxxxxxxxxxxx
aws s3 sync --acl "public-read" --sse "AES256" public/ s3://$BUCKET_NAME --exclude 'post'
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths /index.html / /page/*
@tolleiv
tolleiv / helm.sh
Created July 15, 2017 06:43
Have a service account for helm/tiller only
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm init --service-account tiller --upgrade
helm list
@tolleiv
tolleiv / transform.sh
Created June 28, 2017 12:09
Minimal script to transform a list of files into the full tree with all parent folders (used to generate rsync-filters)
#!/bin/sh
while read -r line ; do
DIR=$(dirname $line)
ORIG_IFS=$IFS
IFS='/'
subpath=""
for i in $DIR; do
subpath+="$i/"
echo "$subpath"
done