Skip to content

Instantly share code, notes, and snippets.

View inxilpro's full-sized avatar

Chris Morrell inxilpro

View GitHub Profile
@inxilpro
inxilpro / http_build_query.php
Created September 23, 2014 15:34
http_build_query polyfill
<?php
if (!defined('PHP_QUERY_RFC1738')) {
define('PHP_QUERY_RFC1738', 1);
}
if (!defined('PHP_QUERY_RFC3986')) {
define('PHP_QUERY_RFC3986', 2);
}
@inxilpro
inxilpro / gist:76b4c751893752004fe8
Last active August 29, 2015 14:06
Links of note

Humans Need Not Apply

Great video that argues a lot of my points re: automation killing jobs. This is not a bad thing. But I do believe it is an inevitable thing. We need to be thinking about how to prepare for a world where most jobs are done by machines.

NPR: Unemployment and Disability

If you don't believe this is a real thing, listen to This American Life: Trends With Benefits (part of the link above). People are becoming not just unemployed, but unemployable. A lot of this

@inxilpro
inxilpro / fish_prompt.fish
Created October 6, 2014 17:06
~/.config/fish/functions/
## Function to show a segment
function prompt_segment -d "Function to show a segment"
# Get colors
set -l bg $argv[1]
set -l fg $argv[2]
# Set 'em
set_color -b $bg
set_color $fg
@inxilpro
inxilpro / export-grants.sh
Created November 25, 2014 20:53
Export all MySQL user permissions
read -s -p "Enter MySQL password for root: " root_password
root_password=$(printf '%q' $root_password)
grants_command='SELECT DISTINCT CONCAT("SHOW GRANTS FOR `", user, "`@`", host, "`;") AS "query" FROM `mysql`.`user`;'
grants=$(mysql -N -s --user=root --password=$root_password --execute="$grants_command")
mysql -N -s -r --user=root --password=$root_password --execute="$grants"
<!DOCTYPE html>
<html>
<head>
<title>#000000</title>
<link href="//fonts.googleapis.com/css?family=Oswald:400,700" rel="stylesheet" type="text/css" />
<style>
html, body {
height: 100%;
overflow: hidden;
}
@inxilpro
inxilpro / forever.sh
Created January 6, 2015 16:52
forever init.d script
#!/bin/bash
# chkconfig: 345 88 08
# description: Forever for Node.js
# ----------------------------------------------------------------------
# Configuration
# ----------------------------------------------------------------------
# Run node scripts as this user
RUN_AS=node
@inxilpro
inxilpro / 1-styles.less
Last active August 29, 2015 14:23
LESS preprocessor idea
/* Source LESS file */
.my-component {
background: #eee;
.subcomponent {
color: #000;
}
&.extreme {
'use strict';
import { randomBytes } from 'crypto';
import Client from 'deepstream.io-client-js';
export default function(server, port = 6021, bytes = 256) {
const username = '__superadmin__';
const password = randomBytes(bytes).toString('hex');
server.once('started', () => {
@inxilpro
inxilpro / stats.json
Last active August 29, 2016 19:50
Benjamin's Desk Network
{
"ip": "50.207.237.250",
"downloadSpeed": 58.611,
"uploadSpeed": 43.081,
"pings": [
{
"address": "google.com",
"result": "10.174578ms"
},
{
<?php
define('GITHUB_SECRET', '');
set_time_limit(120);
header('Content-Type', 'text/plain');
// Ensure signature exists
if (!isset($_SERVER['HTTP_X_HUB_SIGNATURE'])) {
http_response_code(403);