Skip to content

Instantly share code, notes, and snippets.

@x3rAx
x3rAx / # SSH-Agent.md
Last active April 27, 2024 12:47
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 / # Shellrc.d #.md
Last active April 27, 2024 12:47
Setup instructions for `~/.shellrc.d/`

Shellrc.d

Setup

Create the directory ~/.shellrc.d

mkdir ~/.shellrc.d

@x3rAx
x3rAx / Generate_ssh_key-pair_for_Bamboo_(when_Bamboo_uses_a_stupid_Java_implementation_of_git).md
Last active April 23, 2024 02:14
Generate ssh key-pair for Bamboo (when Bamboo uses a stupid Java implementation of git)

The Problem

Bamboo (at least the instance I have to work with) is using a Java implementation of git (JGit) that has problems reading the new SSH key-file format.

In earlier versions, ssh-keygen generated private keys that looked like:

-----BEGIN RSA PRIVATE KEY-----
...

-----END RSA PRIVATE KEY-----

@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 / .gitignore
Created August 6, 2015 20:36
Gitignore with .gitkeep
# +----------------------------+
# | IDE files |
# +----------------------------+
/.idea
# +----------------------------+
# | Vagrant |
# +----------------------------+
/.vagrant
@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 / # 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 / #-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 / 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