Skip to content

Instantly share code, notes, and snippets.

@grvgr
grvgr / WireGuard-site-to-site.md
Created June 27, 2020 03:32 — forked from insdavm/WireGuard-site-to-site.md
Accessing a subnet that is behind a WireGuard client using a site-to-site setup

WireGuard Site-to-Site

Accessing a subnet that is behind a WireGuard client using a site-to-site setup

Problem Summary

We want to access a local subnet remotely, but it is behind a NAT firewall and we can't setup port forwarding. Outgoing connections work, but all incoming connections get DROPPED by the ISP's routing policy.

Solution Summary

@grvgr
grvgr / links.txt
Created January 8, 2020 22:12 — forked from tavisrudd/links.txt
some links related to my voice coding talk at #pycon
@grvgr
grvgr / ssh-tunnel@.service
Created October 2, 2019 16:24 — forked from guettli/ssh-tunnel@.service
Reliable persistent SSH-Tunnel via systemd (not autossh)
# Reliable persistent SSH-Tunnel via systemd (not autossh)
# https://gist.github.com/guettli/31242c61f00e365bbf5ed08d09cdc006#file-ssh-tunnel-service
[Unit]
Description=Tunnel for %i
After=network.target
[Service]
User=tunnel
ExecStart=/usr/bin/ssh -o "ExitOnForwardFailure yes" -o "ServerAliveInterval 60" -N tunnel@%i
@grvgr
grvgr / keybase.md
Created October 5, 2017 10:22
keybase.md

Keybase proof

I hereby claim:

  • I am grvgr on github.
  • I am grvgr (https://keybase.io/grvgr) on keybase.
  • I have a public key ASDz3AzFY99B_-8SNsjAu-seqK6mF7bUqRG1GHNWKr3d3go

To claim this, I am signing this object:

/* compile: gcc prime.c -o prime -fopenmp */
#include <stdio.h>
#include <time.h>
#include <omp.h>
int main(int argc, char *argv[]) {
double start, end, runTime;
int num = 1, primes = 0, limit;
Latest links are always available at:
https://www.privateinternetaccess.com/pages/client-support
https://www.privateinternetaccess.com/pages/downloads
In case you're unable to access the PIA website:
option 1:
macOS: https://installers.privateinternetaccess.com/download/pia-latest-mac.dmg
Windows: https://installers.privateinternetaccess.com/download/pia-latest-win.exe
Linux: https://installers.privateinternetaccess.com/download/pia-latest-linux.tar.gz
@grvgr
grvgr / gist:aea855e85b0a6230e282
Created January 19, 2016 02:18 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@grvgr
grvgr / latency.markdown
Created January 18, 2016 16:31 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

#!/bin/bash
# -*- mode: shell-script -*-
# requires: brew install brightness
execPath=/usr/local/bin/brightness
brightApps=(iTerm iTerm2 Emacs)
ignoreApps=(Alfred)
logFile=/tmp/auto.brightness.log
logEnable=false

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9