Skip to content

Instantly share code, notes, and snippets.

View longlostnick's full-sized avatar

Nick Larson longlostnick

View GitHub Profile
@longlostnick
longlostnick / cuid.sql
Created October 26, 2022 14:48 — forked from srfrog/cuid.sql
CUIDs for PL/PgSQL
-- Collision-resistant ids optimized for horizontal scaling and performance, for PL/PgSQL.
-- Based on https://github.com/ericelliott/cuid
-- Version 1.0.0
-- Usage: SELECT cuid();
-- BEGIN CONFIG ---
-- Put a unique host ID (int) here per server instance.
-- Once set, this value should not be changed.
@longlostnick
longlostnick / Dockerfile
Created August 6, 2017 21:51 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@longlostnick
longlostnick / values_pointers.go
Created April 5, 2016 06:50 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Hillary", 28} stores the value
@longlostnick
longlostnick / .bashrc
Created March 19, 2016 04:19 — forked from vsouza/.bashrc
Golang 1.5 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@longlostnick
longlostnick / 01_postfix_installer.md
Created February 14, 2016 08:14 — forked from solusipse/01_postfix_installer.md
Postfix + Dovecot + Postgresql + Postfixadmin + Roundcube

Postfix Installer

Following script may be used for configuring complete and secure email server on fresh install of Debian 7. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.

Usage

  1. Run postfix.sh script.
  2. Configure postgres to allow connections.
  3. Configure postfix admin. Remember to set these:
@longlostnick
longlostnick / hashquiz.rb
Last active August 29, 2015 14:24 — forked from potatosalad/hashquiz.rb
Ruby quiz for convert hash "dot paths" into actual hash hierarchy.
#require 'rubygems'
require 'pp'
#require 'ap' # Awesome Print
class Object
# expects [ [ symbol, *args ], ... ]
def recursive_send(*args)
args.inject(self) { |obj, m| obj.send(m.shift, *m) }
end
end
@longlostnick
longlostnick / 0_reuse_code.js
Created March 21, 2014 17:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# Splunk Storm
$ wget [ Download Splunk url ]
$ gunzip -c splunkforwarder-5.0-140868-Linux-x86_64.tgz | tar -xvpf -
$ ./splunkforwarder/bin/splunk start
$ ./splunkforwarder/bin/splunk install app stormforwarder_3de50bc823a711e2b4a81231390e9c34.spl -auth admin:changeme
$ ./splunkforwarder/bin/splunk login -auth admin:changeme
$ ./splunkforwarder/bin/splunk edit user admin -password whatever_you_want
$ ./splunkforwarder/bin/splunk add forward-server forwarder.splunkstorm.com:9997
$ ./splunkforwarder/bin/splunk add monitor /var/www/monologapp/log/fideloper.log # Starts sending data
$ ./splunkforwarder/bin/splunk add monitor /var/log/apache2/error.log
@longlostnick
longlostnick / LICENSE.txt
Created September 29, 2011 22:38 — forked from p01/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri <http://www.p01.org/releases/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE