Skip to content

Instantly share code, notes, and snippets.

Tolleiv Nietsch tolleiv

Block or report user

Report or block tolleiv

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CustomPageViewController.swift
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 Apr 15, 2018
Fixed syntax and added documentation for the timelapse script from https://reps.cc/?p=85
View cap.py
#!/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 / ssh_config
Created Jan 12, 2018
SSH Config so "ssh ip.aws" uses the right key with the right settings
View ssh_config
Host *.aws
IdentityFile ~/.ssh/super-secret-key.pem
User ubuntu
StrictHostKeyChecking no
ProxyCommand nc $(sed -e "s/.aws$//" <<< "%h") %p
View trustsslcertinjava.sh
#!/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 / letsencrypt_2017.md
Last active Nov 3, 2017 — forked from cecilemuller/letsencrypt_2019.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)
View letsencrypt_2017.md

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.

@tolleiv
tolleiv / abort-jenkins-job.groovy
Created Jul 25, 2017
Groovy snippet to abort a build without removing it....
View abort-jenkins-job.groovy
Jenkins.instance.getItemByFullName("JobName").getBuildByNumber(JobNumber).finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build"));
View deploy.sh
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 Jul 15, 2017
Have a service account for helm/tiller only
View helm.sh
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 Jun 28, 2017
Minimal script to transform a list of files into the full tree with all parent folders (used to generate rsync-filters)
View transform.sh
#!/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
@tolleiv
tolleiv / README.md
Last active Apr 18, 2017
Small project which sends measurements from an DHT22 sensor via MQTT into my home automation void.
You can’t perform that action at this time.