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
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.
@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
@JuniorLima
JuniorLima / Error
Created December 3, 2013 13:52
bad interpreter: Too many levels of symbolic links
vagrant@precise64:~/.virtualenvs/djangoproj$ /home/vagrant/.virtualenvs/djangoproj/bin/pip
-bash: /home/vagrant/.virtualenvs/djangoproj/bin/pip: /home/vagrant/.virtualenvs/djangoproj/bin/python2.7: bad interpreter: Too many levels of symbolic links
@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 ();

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
@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/
@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
@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--) {
@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"}