Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
paxperscientiam / bash-args-options
Created July 9, 2017 01:03 — forked from un33k/bash-args-options
Bash - Simple Skeleton for arg parsing in bash
#!/bin/bash
# Argument = -t test -r server -p password -v
usage()
{
cat << EOF
usage: $0 options
This script run the test1 or test2 over a machine.
@paxperscientiam
paxperscientiam / frontendDevlopmentBookmarks.md
Created July 15, 2017 17:51 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@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 / 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"

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 / 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();
});
}
@paxperscientiam
paxperscientiam / ask.sh
Created February 24, 2018 23:00
Bash General-Purpose Yes/No Prompt Function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# https://djm.me/ask
local prompt default reply
while true; do

Google Apps Script Gmail Utilities

##sendAndLabel(recipient, subject, body, options, label)##

An alternative to GmailApp.sendEmail(), which applies a label to the message thread in the sender's account.

Sends an email message with optional arguments. The email can contain plain text or an HTML body. The size of the email

@paxperscientiam
paxperscientiam / gmail-github-filters.md
Created August 30, 2018 05:08 — forked from ldez/gmail-github-filters.md
Gmail and GitHub - Filters

Gmail and GitHub

Create new filters and create new labels.

Pull Request

from:(notifications@github.com) AND {"Patch Links" "approved this pull request." "requested changes on this pull request." "commented on this pull request." "pushed 1 commit." "pushed 2 commits." "pushed 3 commits."}

label: gh-pull-request

@paxperscientiam
paxperscientiam / media-queries.css
Created October 17, 2018 22:24 — forked from hemantajax/media-queries.css
Very useful media queries snippets
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {