Skip to content

Instantly share code, notes, and snippets.

View RichardKnop's full-sized avatar
🎯
Focusing

Richard Knop RichardKnop

🎯
Focusing
View GitHub Profile
{
"timestamp": 1441804592.178703,
"message": "Request failed: 500: {\"code\"=>10001, \"description\"=>\"no implicit conversion of Errno::ENOSPC into String\", \"error_code\"=>\"CF-TypeError\", \"backtrace\"=>[\"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/lib/cloud_controller/resource_pool.rb:105:in `+'\", \"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/lib/cloud_controller/resource_pool.rb:105:in `rescue in resource_known?'\", \"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/lib/cloud_controller/resource_pool.rb:98:in `resource_known?'\", \"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/lib/cloud_controller/resource_pool.rb:35:in `block in match_resources'\", \"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/lib/cloud_controller/resource_pool.rb:35:in `select'\", \"/var/vcap/packages/cloud_controller_ng/cloud_controller_ng/lib/cloud_controller/resource_pool.rb:35:in `match_resources'\", \"/var/vcap/packages/cloud_controller_ng/cloud_contro
package main
import (
"encoding/xml"
"fmt"
)
type getFileRequest struct {
XMLName struct{} `xml:"http://tempuri.org/ getFile"`
User string `xml:"userName"`
@RichardKnop
RichardKnop / gist:0e205ccafc964a8ac0831d1730e2252f
Created November 11, 2016 10:24 — forked from ericandrewlewis/gist:95239573dc97c0e86714
Setting up a WordPress site on AWS

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.

@RichardKnop
RichardKnop / quicksort.go
Last active November 14, 2016 13:05
Two alternative quicksort implementations
package main
import (
"log"
"math/rand"
)
// Quicksort sorts slice of integers from smallest to greatest number
func Quicksort(a []int) []int {
if len(a) < 2 {
4 error(s) occurred:
* apply operation: Real and shadow diffs do not match! Real diff:
module.ca:
module.elasticcache:
module.etcd:
module.nats-streaming-server:
module.rds:
module.registry:
### Keybase proof
I hereby claim:
* I am RichardKnop on github.
* I am richardknop (https://keybase.io/richardknop) on keybase.
* I have a public key whose fingerprint is 8E8A 9426 9E82 5411 752E ECA1 4631 66AC D49B 535C
To claim this, I am signing this object:
@RichardKnop
RichardKnop / accounting.sql
Created January 5, 2017 06:55 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@RichardKnop
RichardKnop / golang-tls.md
Created May 26, 2017 13:31 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@RichardKnop
RichardKnop / machinery.go
Created June 26, 2017 14:12
Machinery example: group of 100 tasks
package main
import (
"fmt"
"os"
"time"
"github.com/RichardKnop/machinery/v1"
"github.com/RichardKnop/machinery/v1/config"
"github.com/RichardKnop/machinery/v1/log"