Skip to content

Instantly share code, notes, and snippets.

View perguth's full-sized avatar

Per Guth perguth

View GitHub Profile
@zOrg1331
zOrg1331 / wireguard_layer2.md
Last active April 22, 2024 11:37
wireguard, wireguard layer 2, wireguard over TCP

Intro

This note describes how to connect two networks/devices/VMs over public network using Wireguard with Layer 2 support (ARP, IPv6 link-local, etc).

This can also be achieved using SSH and its "tap" tunnel, however, it does not provide the same level of latency and bandwidth as full-blown VPN such as Wireguard.

In addition, this note describes how to tunnel Wireguard over TCP connection. This may be of use if you encounter firewall in-between so, for instance, you can use TCP port 443 only.

Objective

@tdegrunt
tdegrunt / keyboardLayout.json
Last active April 8, 2024 08:48
Visual Studio Code (vscode/code) Colemak keyboard layout
{
"layout": {
"id": "com.apple.keylayout.Colemak",
"localizedName": "Colemak",
"lang": "en"
},
"rawMapping": {
"KeyA": {
"value": "a",
"valueIsDeadKey": false,
@perguth
perguth / computer
Last active July 23, 2019 14:01
Sleep host when Mosh is idle. Wake up on reconnect.
#!/bin/sh
wake-computer
echo 🚀 Connecting Mosh.
mosh user@computer.y
@jan-warchol
jan-warchol / sync-history.sh
Last active February 4, 2024 04:52
Synchronize history across bash sessions
# Synchronize history between bash sessions
#
# Make history from other terminals available to the current one. However,
# don't mix all histories together - make sure that *all* commands from the
# current session are on top of its history, so that pressing up arrow will
# give you most recent command from this session, not from any session.
#
# Since history is saved on each prompt, this additionally protects it from
# terminal crashes.
var hypercore = require('hypercore')
var ram = require('random-access-memory')
var feed = hypercore(ram)
feed.append('hello world')
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active April 19, 2024 16:03
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@ldong
ldong / download_egghead_videos.md
Last active December 7, 2023 16:16
download egghead videos

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});
@kyledrake
kyledrake / ipfs-refs-daemon.sh
Last active August 18, 2019 18:00
IPFS replication service with one line of unix shell code!
#!/bin/bash
# First, install ncat: http://nmap.org/ncat/
# Usually comes with the 'nmap' package on distributions.
ncat -k -v -l -p 5555 -c 'ipfs refs local | gzip'
# To retrieve on the client machine:
# nc 127.0.0.1 5555 | gunzip | ipfs pin add -r
@dylansmith
dylansmith / npm_userspace.sh
Created January 12, 2015 10:50
Configure npm to install global modules to userspace (set npm prefix to ~/npm)
#!/bin/bash
DIR=~/npm
if [[ ! -e $DIR ]]; then
mkdir $DIR
elif [[ ! -d $DIR ]]; then
echo "$DIR exists but is not a directory" 1>&2
exit 1
fi