Skip to content

Instantly share code, notes, and snippets.

Evan Phoenix evanphx

Block or report user

Report or block evanphx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@evanphx
evanphx / map.diff
Created Sep 6, 2016
clone(2) causing heap growth?
View map.diff
root@ea0a4fce183c:/proc/10# diff -u /tmp/maps6 /tmp/maps7
--- /tmp/maps6 2016-09-06 00:17:49.464078812 +0000
+++ /tmp/maps7 2016-09-06 00:42:58.275517610 +0000
@@ -1,7 +1,7 @@
564fdc34d000-564fdc637000 r-xp 00000000 00:2e 68 /usr/local/bin/ruby
564fdc836000-564fdc83d000 rw-p 002e9000 00:2e 68 /usr/local/bin/ruby
564fdc83d000-564fdc84d000 rw-p 00000000 00:00 0
-564fdd644000-564fde03b000 rw-p 00000000 00:00 0 [heap]
+564fdd644000-564fde3a4000 rw-p 00000000 00:00 0 [heap]
7f63fd3fb000-7f63fd421000 r-xp 00000000 00:2e 34 /lib/x86_64-linux-gnu/libtinfo.so.5.9
View gist:9ccfdb01032ff67dac8fd957134403f3
// OS X comm page time offsets
// http://www.opensource.apple.com/source/xnu/xnu-1699.26.8/osfmk/i386/cpu_capabilities.h
#define nt_tsc_base 0x50
#define nt_scale 0x58
#define nt_shift 0x5c
#define nt_ns_base 0x60
#define nt_generation 0x68
#define gtod_generation 0x6c
#define gtod_ns_base 0x70
#define gtod_sec_base 0x78
View gist:b5b66489719945ec821f
export KUBERNETES_PROVIDER=aws
export MASTER_SIZE=m4.large
export MINION_SIZE=m4.large
export NUM_MINIONS=4
export KUBE_AWS_INSTANCE_PREFIX=k8sp1
export MINION_ROOT_DISK_SIZE=64
export MASTER_RESERVED_IP=auto
@evanphx
evanphx / increase.json
Created Mar 3, 2016
Bug in Prometheus increase?
View increase.json
{
"status": "success",
"data": {
"resultType": "vector",
"result": [
{
"metric": {
"instance": "10.244.2.45:9090",
"job": "kubernetes",
"monitor": "kubernetes",
@evanphx
evanphx / component.js
Last active Feb 10, 2016
Ember observer
View component.js
import Ember from 'ember';
export default Ember.Component.extend({
organizations: Ember.inject.service("organizations"),
activeOrgChange: Ember.observer("organizations.active", function() {
var name = this.get("organizations.active.name");
useName(name);
}
})
@evanphx
evanphx / page.html
Created Feb 6, 2016
Weird TWC page
View page.html
veritas :: vk-git/valar-client> curl -L http://www.google.com
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>Road Runner</title>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<meta content="MSHTML 6.00.2800.1400" name="GENERATOR" />
View log.go
package log
import "github.com/Sirupsen/logrus"
func InfoK(str string, args ...interface{}) {
f := logrus.Fields{}
for i := 0; i < len(args); i += 2 {
f[args[i].(string)] = args[i+1]
}
View log_rails.rb
require 'json'
class SRailsLogger < SLogger
def emit(opts)
Rails.logger.info JSON.generate(opts)
end
end
SLog = SRailsLogger.new
@evanphx
evanphx / log.rb
Created Oct 20, 2015
Structured Logging
View log.rb
require 'json'
class SLogger
def log(event, opts={})
opts[:event] = event.to_s
emit opts
end
def emit(opts)
$stdout.puts JSON.generate(opts)
@evanphx
evanphx / watch_your_back.go
Last active Oct 5, 2015
defensive golang channels
View watch_your_back.go
select {
case b := <-i.c:
buf.Write(i.header)
buf.Write(nl)
buf.Write(b)
buf.Write(nl)
if buf.Len() > i.Config.FlushThreshold {
flush = true
}
You can’t perform that action at this time.