Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
paxperscientiam / craigslist-sans-bs.txt
Last active January 8, 2018 01:09
Craigslist search filters
Useful for jobs and gigs:
Craigslist gigs in Vermont:
Example for gigs in Vermont sorted by date:
https://vermont.craigslist.org/search/ggg?query=-bondage+-%28exotic+dancer*%29+-stripper*+-nude+-massage+-escort*+-model*+-sexy+-snapchat+-kik+-survey*+-unpaid+-%28photo+shoot%29+-%28CL+POSTER%29+-scene*+-casting+-film+-actor*&sort=date&is_paid=yes
Craigslist jobs in Vermont:
@paxperscientiam
paxperscientiam / spinner.bash
Last active November 30, 2017 05:46
Simple 'spinner' for your scripts. Disclaimer: use at your own peril!
#!/usr/bin/env bash
:
function spinner () {
trap 'tput cnorm' RETURN SIGINT
:
sprite=('|' '/' '–' '\')
SECONDS=0
TIME_LIMIT=
:
local OPTIND opt d
@paxperscientiam
paxperscientiam / -
Last active November 20, 2017 02:46
#!/bin/bash
# notify user when connected to public wifi
shopt -s expand_aliases
alias wifi='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'
# exit if not connected to wifi
wifi -I | grep running > /dev/null
@paxperscientiam
paxperscientiam / camelCase.js
Created November 15, 2017 02:09 — forked from johnsmith17th/camelCase.js
To convert string to camel case in javascript.
function toCamelCase(str) {
return str.toLowerCase().replace(/(?:(^.)|(\s+.))/g, function(match) {
return match.charAt(match.length-1).toUpperCase();
});
}

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

@paxperscientiam
paxperscientiam / globalpips.bash
Last active December 28, 2017 23:23
Custom shell functions for invoking pip3 with python36 and pip with python27 for installation and packages listing
#!/usr/bin/env bash
# Note: only tested on macOS; asssumes appropriate pips installed
# Disclaimer: use at your own peril
# Parting words: have a nice day
shopt -s expand_aliases
# edit this accordingly
pyverz=(
@paxperscientiam
paxperscientiam / TrueColour.md
Created October 20, 2017 04:28 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
@paxperscientiam
paxperscientiam / seekincompatonedrive.sh
Created October 9, 2017 01:32
Find files with filenames containing characters incompatible with OneDrive.
#!/bin/sh
/usr/bin/find . \( -iname "*\:*" \
-o -iname "*\?*" \
-o -iname "*\**" \
-o -iname "*\\\*" \
-o -iname "*\<*" \
-o -iname "*\>*" \
-o -iname "*\|*" \
-o -iname "*\"*" \) -print
@paxperscientiam
paxperscientiam / install-mosh.sh
Created October 1, 2017 18:18 — forked from jaywilliams/install-mosh.sh
Compiling and running mosh on Dreamhost (Updated - 2017)
#!/usr/bin/env bash
# Thanks to @samsonjs for the cleaned up version:
# https://gist.github.com/samsonjs/4076746
PREFIX=$HOME/local
VERSION=1.2.6
# Create Source Directory
mkdir -p $PREFIX/src
@paxperscientiam
paxperscientiam / create_tunnel
Last active October 3, 2017 15:10
Julian Simioni's to accesss *nix machine behind home router (tweaked)
#!/bin/bash
# 'pax' is simply an alias for one my ssh connections,
# which are configured in your user ssh_config file.
# For more info, see Julian Simioni's original post:
# https://juliansimioni.com/blog/howto-access-a-linux-machine-behind-a-home-router-with-ssh-tunnels/
relay_server="pax"
createTunnel() {