Skip to content

Instantly share code, notes, and snippets.

View benduran's full-sized avatar

Ben Duran benduran

View GitHub Profile
@benduran
benduran / Expose X 11 Display IP from WSL to the Windows Host.md
Created March 15, 2022 20:51
Expose X 11 Display IP from WSL to the Windows Host

Add this to your .bashrc, .zshrc (or equivalent)

# Get the IP address of the host from /etc/resolv.conf
export WSL_HOST=$(tail -1 /etc/resolv.conf | cut -d' ' -f2)

# Set the display path
export DISPLAY=$WSL_HOST:0.0
@benduran
benduran / Set MTU size in WSL to fix discrepancies between VPN clients on Windows Host and the WSL machine.md
Created March 15, 2022 20:49
Set MTU size in WSL to fix discrepancies between VPN clients on Windows Host and the WSL machine

Update MTU without entering a password¶

This corrects issues you might have with various VPN Clients having discrepancies with MTU size between WSL and the Windows Host.

Create a file /usr/local/sbin/mtu and add the following:

#!/bin/bash

ip link set dev eth0 mtu 1400
@benduran
benduran / .wslconfig
Created March 15, 2022 20:47
Sample WSL2 Config with Black Hole Discovery Enabled
[wsl2]
memory=8GB
swap=0
localhostForwarding=true
processors=8
# This enables black hole discovery on WSL boot
kernelCommandLine=net.ipv4.tcp_mtu_probing=2
# Stolen from https://eplt.medium.com/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1
# Confirmed working on WSL2
sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install build-essential autoconf libtool git-core
sudo apt-get build-dep imagemagick libmagickcore-dev libde265 libheif
cd /usr/src/
sudo git clone https://github.com/strukturag/libde265.git
sudo git clone https://github.com/strukturag/libheif.git
@benduran
benduran / keycodes.json
Created March 8, 2021 19:17
JavaScript keycode mappings (includes Shift modifier)
{
"Keys": {
"Special": {
"NonMovement": {
"9": "Tab",
"13": "Enter",
"16": "Shift",
"17": "Control",
"18": "Alt",
"19": "Pause",
@benduran
benduran / .gitconfig
Created January 23, 2021 02:57
Configure git on Linux (Ubuntu) to use Meld as the merge and diff tool (also works on WSL if you have an xdesktop installed)
[merge]
tool = meld
[mergetool "meld"]
cmd = meld \"$LOCAL\" \"$MERGED\" \"$REMOTE\" --output \"$MERGED\"
path = "/usr/bin/meld"
[diff]
tool = meld
guitool = meld
prompt = false
[difftool "meld"]
@benduran
benduran / Git-Squash-Implementation.md
Created May 28, 2020 20:34 — forked from hlecuanda/Git-Squash-Implementation.md
Git Squash alias, from amazingly clean explanation on stackoverflow

From This other answer on the same thread

Based on Chris Johnsen's answer:

I added this line to the [alias] section of my git config file (~/.gitconfig):

squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"
@benduran
benduran / .eslintrc.json
Created January 27, 2020 16:03
TypeScript & React-friendly ESlint configuration
{
"parser": "@typescript-eslint/parser",
"extends": [
"airbnb",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true

Keybase proof

I hereby claim:

  • I am benduran on github.
  • I am dr_dvran (https://keybase.io/dr_dvran) on keybase.
  • I have a public key ASDOJPBDUW9Wpci8RWB47KDNco3eHO8Ixyvqrih0UcFjdQo

To claim this, I am signing this object:

@benduran
benduran / README-Template.md
Created August 19, 2019 19:36 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites