Skip to content

Instantly share code, notes, and snippets.

@x3rAx
x3rAx / #-HyperV-dynamic-ports-#.md
Last active September 30, 2020 18:30
Hyper-V dynamic ports fix

Hyper-V uses dynamics port range to bind some ports. This range is so low that e.g. port 3306 can be used by it. To set the dynamic port range to begin at port 49152 use:

netsh interface ipv4 set dynamic tcp start=49152 num=16384

To show the current setting use:

netsh interface ipv4 show excludedportrange protocol=tcp
@x3rAx
x3rAx / # Rust Notes #.md
Last active May 18, 2020 18:43
Rust Notes

Safe conversion from u32 to i32:

use std::convert::TryFrom;

fn main() {
    let good: u32 = 50;
    let ok: i32 = i32::try_from(good).unwrap();
    println!("{} -> {}", good, ok);
@x3rAx
x3rAx / # Shellrc.d #.md
Last active September 29, 2022 17:38
Setup instructions for `~/.shellrc.d/`

Shellrc.d

Setup

Create the directory ~/.shellrc.d

mkdir ~/.shellrc.d

@x3rAx
x3rAx / vscode-keybindings-cheat-sheet.md
Last active March 23, 2020 08:39
My VSCode Keybindings Cheat Sheet

My VSCode Keybindings Cheat Sheet

Multi Cursor

  • ctrl + alt + j - Add cursor below
  • ctrl + alt + k - Add cursor above
@x3rAx
x3rAx / # SSH-Agent.md
Last active June 2, 2021 11:54
SSH Agent

Note:

Replace @ with / in filenames.

Set up your .bashrc to use .shellrc.d.

Make sure ssh-agent, ps and awk are installed and that $USER is set to your username.

@x3rAx
x3rAx / # n-install #.md
Last active August 4, 2022 07:50
n-install

Install n the node package manager

Prerequisites

The following tools must be installed

  • git
  • curl
@x3rAx
x3rAx / trim-string.sh
Created January 30, 2020 10:32
Trim whitespaces from a string with pure bash
trim_l() {
local str="$1"
if [[ $str =~ ^[[:space:]]*(|[^[:space:]].*)$ ]]; then
str="${BASH_REMATCH[1]}"
fi
echo "$str"
}
trim_r() {
local str="$1"
@x3rAx
x3rAx / fix-permissions.sh
Created September 27, 2019 12:43
Shell script to easily fix permissions recursively on files and directories (Set user / group / file mode / dir mode)
#!/usr/bin/env bash
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# MIT License
#
# Copyright (c) 2019 Björn Richter
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@x3rAx
x3rAx / docker-compose-up-fix.sh
Last active December 2, 2019 12:11
Transparently change default behavior of `docker-compose up` to be detached
# DISCLAIMER
#
# I do not take any responsibility and I'm not liable for any damage caused
# through the usage of this script.
#
# I have tested every case I can think of and I'm pretty confident, that there
# are no major errors in this script but future versions of `docker-compose`
# might introduce changes that interfere with this wrapper.
#
# ==> Use at your own risk! <==
# Maintainer: Alexey Stukalov <astukalov@gmail.com>
# Contributor: Muflone http://www.muflone.com/contacts/english/
pkgname=smartgit
pkgver=19.1.0
pkgrel=1
pkgdesc='Git client with Hg and SVN support.'
arch=('any')
url="http://www.syntevo.com/smartgit"
license=('custom')