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
#!/usr/bin/env bash | |
# Execute with the following command | |
# /bin/bash -c "$(curl -fsSL https://gist.githubusercontent.com/jcarley/3d46571591dc9b1cabfe2859d926dbc8/raw/3f19acd19f03e48e7b688537709c442b75dde354/install_python.sh)" | |
sudo apt-get update | |
sudo apt-get install -y build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev tar wget vim | |
mkdir -p ~/downloads/python |
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
using Microsoft.AspNetCore.Mvc.Rendering; | |
using Microsoft.AspNetCore.Mvc.ViewFeatures; | |
using Microsoft.AspNetCore.Razor.TagHelpers; | |
namespace MyApplication.Web.TagHelpers | |
{ | |
/// <summary> | |
/// Reference: https://stackoverflow.com/questions/20410623/how-to-add-active-class-to-html-actionlink-in-asp-net-mvc | |
/// Item: Easy ASP.NET 3.0 and TagHelpers | |
/// </summary> |
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
# install rbenv on Amazon Linux | |
# first we need some prerequisites | |
sudo yum install -y git gcc make readline-devel openssl-devel | |
# now install rbenv | |
git clone git://github.com/rbenv/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
source ~/.bashrc |
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
version: '3.8' | |
services: | |
db: | |
ipc: host | |
image: postgres:11.9-alpine | |
ports: | |
- "5432:5432" | |
environment: | |
- TERM=xterm | |
- POSTGRES_PASSWORD=password |
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 | |
# initial OS updates and configuration | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo raspi-config | |
sudo reboot | |
passwd | |
sudo apt-get update && sudo apt-get install ufw vim curl wget git -y |
NewerOlder