Skip to content

Instantly share code, notes, and snippets.

@ntrepid8
ntrepid8 / Vagrantfile
Last active August 7, 2016 17:03
A nice base Vagrantfile for debian/jessie64 on Virtualbox.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
@ntrepid8
ntrepid8 / rust_examples.md
Last active January 22, 2019 06:57
Examples of things I need while learning Rust.

Rust Examples

Disclaimer: there may be errors in these examples. Copy them at your own risk.

Some snippets and examples I want to be able to refer to while learning the Rust Language. Having the snippets here makes it easier for me to remember them.

Convert Vec<T> to Vec<String>

I have found it useful to be able to convert a Vec<T> into a Vec<String>, especially for tests where I want to convert a Vec<str> into a Vec<String> for use elsewhere in the application.

@ntrepid8
ntrepid8 / .screenrc-main-example
Created July 13, 2016 16:22 — forked from ChrisWills/.screenrc-main-example
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@ntrepid8
ntrepid8 / bash-prompt.md
Created July 25, 2016 14:05
A bash prompt example

To get a bash promp that looks like this:

bash-prompt-example

Use this code in your .bashrc file:

source /etc/bash_completion.d/git-prompt
if [ "$color_prompt" = yes ]; then
 #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
@ntrepid8
ntrepid8 / autossh-jump-rtunnel.service
Last active October 7, 2020 01:45
AutoSSH reverse tunnel service config for systemd
[Unit]
Description=AutoSSH reverse tunnel service for jump.you.io 100022 -> 22
After=network.target
[Service]
Environment="AUTOSSH_GATETIME=0"
ExecStart=/usr/bin/autossh -M 0 -o "ExitOnForwardFailure=yes" -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -NR 10022:127.0.0.1:22 user@jump.you.io -i /home/root/.ssh/id_rsa
[Install]
WantedBy=multi-user.target
@ntrepid8
ntrepid8 / muslrust-cross-notes.md
Last active October 7, 2016 05:24
muslrust-cross-notes

MuslRust-Cross Notes

There are several primary steps:

  1. build toolchain with crosstool-ng
  2. compile libunwind and add to toolchain
  3. compile std with the new toolchain
  4. link rust-cross toolchain with rustup
  5. build rust binaries :)
@ntrepid8
ntrepid8 / gen_server_tpl.ex
Created November 2, 2016 16:06
Elixir GenServer Template
defmodule GenServerTpl do
@moduledoc """
A GenServer template for a "singleton" process.
"""
use GenServer
# Initialization
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, opts, [name: __MODULE__])
end
@ntrepid8
ntrepid8 / git-github-pro-tips.md
Last active July 5, 2017 19:48
Git/GitHub Pro Tips - helpful resources for managing git repos with github.com
@ntrepid8
ntrepid8 / .gitconfig
Last active March 8, 2017 22:24
Git config file with useful aliases
[alias]
co = checkout
ci = commit
st = status
br = branch
s = status
ls = branch --sort=committerdate
lsa = branch --list --sort=committerdate --all
lsr = branch --list --sort=committerdate --remotes
f = fetch
@ntrepid8
ntrepid8 / host-interface-route.sh
Created April 7, 2017 00:19
Script to create static routes for individual host names and network interfaces
#!/usr/bin/env bash
# Create a static route for a given host/domain over a specific network interface.
# Put this script in /etc/network/if-up.d/host-interface-route so it runs when the interface comes up
# Script was developer for Ubuntu 16.04 LTS running Network Manager (Gnome 3)
# I use this script to prevent my VPN connections from interfering with automatic reverse SSH tunnles
# to my jump box running in the cloud.
# network interface to target