This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import datetime | |
import dateutil.parser | |
class JSONEncoder(json.JSONEncoder): | |
def default(self, obj): | |
if isinstance(obj, datetime.datetime): | |
return { | |
'type': 'datetime', | |
'data': obj.isoformat() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIBEVENT_VERSION="2.1.12-stable" | |
TMUX_VERSION="3.2a" | |
sudo yum install -y gcc kernel-devel make ncurses-devel openssl-devel | |
curl -LOk https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VERSION}/libevent-${LIBEVENT_VERSION}.tar.gz | |
tar -xf libevent-${LIBEVENT_VERSION}.tar.gz | |
cd libevent-${LIBEVENT_VERSION} | |
./configure --prefix=/usr/local | |
make -j4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set gdefault | |
set hlsearch | |
set ignorecase | |
set iskeyword | |
set incsearch | |
set number | |
set clipboard+=unnamed | |
set relativenumber | |
set showmode | |
set smartcase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DirectUploadController < ApplicationController | |
def create | |
response = generate_direct_upload(blob_params) | |
render json: response | |
end | |
private | |
def blob_params | |
params.require(:file).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service salt-minion stop | |
rm -f /etc/salt/pki/minion/minion_master.pub | |
echo "master: salt" > /etc/salt/minion | |
service salt-minion start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": "sts:AssumeRole", | |
"Principal": { | |
"Service": "ec2.amazonaws.com" | |
}, | |
"Effect": "Allow", | |
"Sid": "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Generates client and server certificates used to enable HTTPS | |
# remote authentication to a Docker daemon. | |
# | |
# See http://docs.docker.com/articles/https/ | |
# | |
# To start the Docker Daemon: | |
# | |
# sudo docker -d \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This script stands on the shoulders of giants. | |
# | |
# It is written and tested for Ubuntu 16.04 on Digital Ocean using a 1GB droplet. | |
# Anything less than 1GB of memory may cause issues with anything memory intensive | |
# like imports/exports. | |
# | |
# It does the following: | |
# 1) Opens the appropriate ports for Unifi, SSH, Web/SSL traffic via iptables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": ["es2015", "react", "babel-preset-stage-0"] | |
} |
NewerOlder