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
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod |
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 Foundation | |
/// Parse RFC 3339 date string to NSDate | |
/// | |
/// :param: rfc3339DateTimeString string with format "yyyy-MM-ddTHH:mm:ssZ" | |
/// :returns: NSDate, or nil if string cannot be parsed | |
public func dateForRFC3339DateTimeString(rfc3339DateTimeString: String) -> NSDate? { | |
let formatter = getThreadLocalRFC3339DateFormatter() | |
return formatter.dateFromString(rfc3339DateTimeString) | |
} |
FYI: I install ginkgo into $HOME/gocode. My .bash_profile
does this:
export GOPATH=$HOME/gocode
export PATH=$PATH:$GOPATH/bin
And I do a custom GOPATH per project. I don't like global GOPATH for all projects. So on projectx, I have to cd projectx && export GOPATH=$(pwd):$GOPATH
for example. It is a minor inconvenience, but I think it is cleaner.
This means, I want to install binaries like ginkgo
into my global GOPATH and not necessarily my project path. Hope that makes sense.
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
docker run -it --rm -p 4222:4222 -p 6222:6222 -p 8222:8222 --name nats-main nats | |
docker run -it --rm --name=nats-2 --link nats-main nats --cluster=nats://0.0.0.0:6222 --routes=nats-route://ruser:T0pS3cr3t@nats-main:6222 | |
docker run -it --rm --name=nats-3 --link nats-main nats --cluster=nats://0.0.0.0:6222 --routes=nats-route://ruser:T0pS3cr3t@nats-main:6222 | |
You now have a 3-node nats cluster. See http://localhost:8222/ |
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
Add the `replication` section to the mongod.conf file: | |
``` | |
$cat /usr/local/etc/mongod.conf | |
systemLog: | |
destination: file | |
path: /usr/local/var/log/mongodb/mongo.log | |
logAppend: true | |
storage: | |
engine: mmapv1 |
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
// super quick hack to test mongodb replica set. once the replica set is running | |
// attemtp rs.stepDown() or just kill the primary and observe the behavior. | |
package main | |
import ( | |
"fmt" | |
mgo "gopkg.in/mgo.v2" | |
"time" | |
) |
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
"use strict"; | |
/*\ | |
|*| | |
|*| :: Number.isInteger() polyfill :: | |
|*| | |
|*| https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger | |
|*| | |
\*/ |
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 | |
if (( $# != 2)) | |
then | |
echo "Usage: md2pdf.sh <input.md> <output.pdf>" | |
exit 1 | |
fi | |
markdown $1 | htmldoc --cont --headfootsize 8.0 --linkcolor blue --linkstyle plain --format pdf14 - > $2 |
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
WITH table_scans as ( | |
SELECT relid, | |
tables.idx_scan + tables.seq_scan as all_scans, | |
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes, | |
pg_relation_size(relid) as table_size | |
FROM pg_stat_user_tables as tables | |
), | |
all_writes as ( | |
SELECT sum(writes) as total_writes | |
FROM table_scans |
NewerOlder