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

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 ();
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 23, 2024 03:11
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
@theraccoonbear
theraccoonbear / gist:e8a2c127b306745bf7e4
Created October 21, 2015 14:45
Composer Installation on HostMonster
/usr/bin/php56s -d register_argc_argv=1 "./composer.phar" install
@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"}
@josephspurrier
josephspurrier / values_pointers.go
Last active April 20, 2024 04:58
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
@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
The Challenge
-------------
Given the following riddle, write a regular expression describing all possible answers,
assuming you never make a move which simply undoes the last one you made.
The Riddle
----------
You are on your way somewhere, taking with you your cabbage, goat, and wolf, as always.
You come upon a river and are compelled to cross it, but you can only carry one of the
three companions at a time. None of them can swim because this isn't THAT kind of riddle.