Skip to content

Instantly share code, notes, and snippets.

View Finkregh's full-sized avatar
🚲

Oluf Lorenzen Finkregh

🚲
View GitHub Profile
@Finkregh
Finkregh / docker-for-mac.md
Created January 9, 2020 10:24 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker for Mac Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@Finkregh
Finkregh / google_dns.md
Created August 2, 2019 15:38 — forked from dwallraff/google_dns.md
Google DNS rate limiting of ICMP - (blatantly stolen from @dupuy's post https://goo.gl/pPjWH7)

TL;DR: At the risk of repeating myself: Google Public DNS is a Domain Name System service, not an ICMP network testing service.

If you want to measure the quality of your DNS service from Google Public DNS, you should use a dnsping tool (https://github.com/farrokhi/dnsdiag [Python] or https://sourceforge.net/projects/dnsping/ [C#]) to send real DNS queries and check for responses. Note that while traceroute -U sends UDP/53 packets, they are not DNS queries, and traceroute -U is not a substitute for dnsping.

If dnsping shows significant levels of unanswered queries (and especially if ping and traceroute do not show any drops), you should check whether your IP address is generating more than 100 queries per second (the default per-IP address QPS limit for Google Public DNS). If you are legitimately generating more than 100 QPS and need to increase your QPS limit, you can [request an increase through the Google Public DNS is

@Finkregh
Finkregh / delete_git_submodule.md
Created July 5, 2019 14:50 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@Finkregh
Finkregh / nginx-tuning.md
Created April 29, 2019 11:19 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@Finkregh
Finkregh / zfs-on-linux-encrypted-create.sh
Last active November 26, 2018 09:19
zfs encrypted pool
# this needs a rather recent verison of ZFS...
# uses /dev/sdb completely
zpool create -m /mnt/zfs/wd-black -o ashift=12 wd-black /dev/sdb
# create volume that is encrypted
zfs create -o encryption=on -o keyformat=passphrase wd-black/crypted
# create subvol inside the crypted volume
zfs create wd-black/crypted/rsync
@Finkregh
Finkregh / hfsc-shape.sh
Created April 11, 2018 17:46 — forked from eqhmcow/hfsc-shape.sh
HFSC - linux traffic shaping's best kept secret
#!/bin/bash
# As the "bufferbloat" folks have recently re-discovered and/or more widely
# publicized, congestion avoidance algorithms (such as those found in TCP) do
# a great job of allowing network endpoints to negotiate transfer rates that
# maximize a link's bandwidth usage without unduly penalizing any particular
# stream. This allows bulk transfer streams to use the maximum available
# bandwidth without affecting the latency of non-bulk (e.g. interactive)
# streams.
@Finkregh
Finkregh / rancher-zerotier.yml
Created March 26, 2018 21:33 — forked from elcritch/rancher-zerotier.yml
Run ZeroTier on RancherOS
#cloud-config
rancher:
services:
zerotier:
image: zerotier/zerotier-containerized:1.2.4
labels:
io.rancher.os.scope: system
volumes:
- /var/lib/zerotier-one:/var/lib/zerotier-one
restart: always
#!/bin/bash
# Make this executable and name it .git/hooks/pre-commit to have commits
# randomly rejected with a prompt to rethink it. The odds are higher for
# longer commits
set -eu
# How many lines a commit must have before it's considered long and should
# have the highest odds of getting an extra prompt
@Finkregh
Finkregh / extend.sh
Created September 29, 2017 08:12 — forked from wvengen/extend.sh
Extend non-HiDPI external display above HiDPI internal display
#!/bin/sh
# extend non-HiDPI external display on DP* above HiDPI internal display eDP*
# see also https://wiki.archlinux.org/index.php/HiDPI
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1`
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1`
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'`
@Finkregh
Finkregh / nginx-cors.conf
Created April 21, 2016 12:07 — forked from sbuzonas/nginx-cors.conf
Nginx CORS maps
map $http_origin $allow_origin {
default "";
"~^https?://(?:[^/]*\.)?(stevebuzonas\.(?:com|local))(?::[0-9]+)?$" "$http_origin";
}
map $request_method $cors_method {
default "allowed";
"OPTIONS" "preflight";
}