Skip to content

Instantly share code, notes, and snippets.

View theraccoonbear's full-sized avatar
💭
oh bother

Don Smith theraccoonbear

💭
oh bother
View GitHub Profile
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@josephspurrier
josephspurrier / values_pointers.go
Last active April 28, 2024 16:41
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@magnetikonline
magnetikonline / README.md
Last active March 16, 2024 02:00
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Assignment
Assign value to variable if variable is not already set, value is returned.

Combine with a : no-op to discard/ignore return value.
${variable="value"}
: ${variable="value"}
@CatTail
CatTail / htmlentity.js
Created November 30, 2012 08:27
Javascript: encode(decode) html text into html entity
// encode(decode) html text into html entity
var decodeHtmlEntity = function(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
});
};
var encodeHtmlEntity = function(str) {
var buf = [];
for (var i=str.length-1;i>=0;i--) {
@camsaul
camsaul / make_db_ssh_tunnel.sh
Created September 24, 2014 20:16
Make a SSH Tunnel to a Postgres DB hosted in Vagrant VM
#! /bin/bash
ssh -L 5555:localhost:5432 vagrant@localhost -p 2222 -i ~/.vagrant.d/insecure_private_key -fNg # local port 5555 <-> Vagrant port 5432
@chengyin
chengyin / linkedout.js
Last active July 11, 2021 15:23
Unsubscribe all LinkedIn email in "one click". For an easier to use version, you can check out the bookmarklet: http://chengyin.github.io/linkedin-unsubscribed/
// 1. Go to page https://www.linkedin.com/settings/email-frequency
// 2. You may need to login
// 3. Open JS console
// ([How to?](http://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers))
// 4. Copy the following code in and execute
// 5. No more emails
//
// Bookmarklet version:
// http://chengyin.github.io/linkedin-unsubscribed/

Convert the giant blob of invalid JSON Robo3T gives you into something consumable.

  • First:
    • Find... (?:ISODate|ObjectId)\(("[^"]+")\) (BSON types)
    • And replace with... $1 (the non-ignored capture group)
  • Second:
    • Find... (/\*\s+\d+\s+\*/) (index comments)
    • And replace with... , (comma to separate array elements)
  • Finally
  • Remove the stray comma where /* 1 */ used to be
@Ovid
Ovid / Boilerplate.pm
Last active August 11, 2020 01:49
use less boilerplate
package Less::Boilerplate;
use 5.26.0;
use strict;
use warnings;
use feature ();