Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am danmrichards on github.
  • I am smeghead (https://keybase.io/smeghead) on keybase.
  • I have a public key ASAaiqxaFHHlsLYELiKmnxi6Zc8vqiVGBZy9qrNUfmyO8Ao

To claim this, I am signing this object:

@danmrichards
danmrichards / client.go
Last active January 31, 2018 23:07
Incrementor - Go service for incrementing and persisting scoped integers
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"sync"
@danmrichards
danmrichards / docker-compose.yml
Created December 4, 2017 21:51
CockroachDB - Docker Compose Manifest. Spins up a simple 3 node CockroachDB cluster.
version: "3"
services:
roach1:
container_name: roach1
image: cockroachdb/cockroach:v1.1.3
command: start --insecure
ports:
- "26257:26257"
- "8080:8080"
volumes:
$app->get('/test', function () use ($app) {
$orders = \App\Models\Order::with('lineItems', 'payments', 'payments.metaData', 'totals', 'metaData')->get();
foreach ($orders as $order) {
print "Spoofing order:" . $order->order_number . "\r\n";
event(new \App\Events\OrderCreated($order));
}
});
#!/usr/bin/expect -f
# Filename: beanstalk-purge
set timeout 1
spawn telnet [lindex $argv 0] [lindex $argv 1]
sleep 1
send "use [lindex $argv 2]\n"
expect "USING"
for {set i 1} {$i < [lindex $argv 3]} { incr i 1 } {
@danmrichards
danmrichards / channel.go
Created June 19, 2017 17:58
Basic golang channel with http
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
passer := &DataPasser{logs: make(chan string)}
@danmrichards
danmrichards / jsonequals.go
Created March 21, 2017 10:41
Compare the equality of 2 JSON byte arrays
package jsonequals
import (
"encoding/json"
"log"
"reflect"
)
// jsonEquals - Compare the equality of two JSON byte arrays.
//
@danmrichards
danmrichards / pubsub.go
Last active March 1, 2017 17:31
Google Pub/Sub experiment with Golang
package main
import (
"fmt"
"log"
"os"
"time"
"cloud.google.com/go/pubsub"
"golang.org/x/net/context"
"google.golang.org/api/option"
@danmrichards
danmrichards / softbank_checksum.php
Last active July 25, 2016 11:31
Checksum calculation algorithm for the Softbank payment service
<?php
/**
* @file
* Example checksum calculation for Softbank.
*/
// Example only. Real hash key value is provided by Softbank.
$hash_key = 'a2d8648d0246a924bed081433930f868c8100224';
@danmrichards
danmrichards / config.fish
Created June 7, 2016 22:14
Fish shell config
### Aliases
# Open specified files in Sublime Text
# "s ." will open the current directory in Sublime
alias s='open -a "Sublime Text"'
# Open specified files in Atom
# "a ." will open the current directory in Sublime
alias a='atom .'