Skip to content

Instantly share code, notes, and snippets.

@kevsmith
kevsmith / output
Last active August 29, 2015 14:06
Reading performance counters using LuaJIT and libstatsgrab
ksmith@abelson:build/(master✗) $ time dev/bin/loom_client ../demos/stats.lua
Host Info
---------------------------------
os_name: Linux
os_release: 3.13.0-30-generic
uptime: 3119735LL
bit_width: 64
max_cpus: 8
cpus: 8
os_version: #55-Ubuntu SMP Fri Jul 4 21:40:53 UTC 2014
@kevsmith
kevsmith / test.lua
Last active August 29, 2015 14:06
test.lua
local function test()
mqtt = require("mqtt/mqtt")
conn = mqtt:new_connection()
conn.user = "guest"
conn.password = "guest"
if conn:connect("localhost", 1883, true) then
conn:loop(100)
conn:publish("testing", "this is a test", mqtt.qos1, false)
conn:loop(100)
conn:disconnect()
@kevsmith
kevsmith / apt-get update
Last active August 29, 2015 14:02
Mirror is working?
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 314df160
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.R7D0sa8jhM --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 314df160
gpg: requesting key 314DF160 from hkp server keyserver.ubuntu.com
gpg: key 314DF160: public key "Launchpad ubuntugis-stable" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
vagrant@precise64:~$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 792bd34e
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.oMkTTWfRz0 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv-keys 792bd34e
gpg: requesting key 792BD34E from hkp server keyserver.ubuntu.com
gpg: key 792BD34E: public key "Launchpad PPA for Ri
> ps ax | grep postgres\:\ planet | grep -v grep | wc -l
183
> ps ax | grep postgres\:\ planet | grep idle | grep -v grep | wc -l
183
> ps ax | grep postgres\:\ planet | grep idle\ in\ trans | grep -v grep | wc -l
42
@kevsmith
kevsmith / gist:11227079
Created April 23, 2014 18:25
East Coast sad panda Google
➜ ~ wget https://mail.google.com
--2014-04-23 14:12:51-- https://mail.google.com/
Resolving mail.google.com... 74.125.228.117, 74.125.228.118, 2607:f8b0:4004:803::1016
Connecting to mail.google.com|74.125.228.117|:443... failed: Operation timed out.
Connecting to mail.google.com|74.125.228.118|:443... failed: Operation timed out.
Connecting to mail.google.com|2607:f8b0:4004:803::1016|:443... failed: No route to host.
#!/usr/bin/python
import os
import sys
import json
import redis
def fetch_group_vars(rconn, env_name, group_name):
keys = rconn.hkeys(env_name + "-groupvars-" + group_name)
if len(keys) == 0:
postgres@db1:~$ s3cmd ls s3://planet-db1-pgxlog-042014/16/*
2014-04-16 19:02 2593400 s3://planet-db1-pgxlog-042014/16/000000010000000000000001.lzo
2014-04-16 19:07 76683 s3://planet-db1-pgxlog-042014/16/000000010000000000000002.lzo
2014-04-16 19:11 76686 s3://planet-db1-pgxlog-042014/16/000000010000000000000003.lzo
2014-04-16 19:16 76685 s3://planet-db1-pgxlog-042014/16/000000010000000000000004.lzo
2014-04-16 19:21 76685 s3://planet-db1-pgxlog-042014/16/000000010000000000000005.lzo
2014-04-16 19:26 76682 s3://planet-db1-pgxlog-042014/16/000000010000000000000006.lzo
2014-04-16 19:31 76685 s3://planet-db1-pgxlog-042014/16/000000010000000000000007.lzo
2014-04-16 19:36 76894 s3://planet-db1-pgxlog-042014/16/000000010000000000000008.lzo
2014-04-16 19:40 727837 s3://planet-db1-pgxlog-042014/16/000000010000000000000009.lzo
* Near Term
1. Worker logs
2. Robustify db0.planet-labs.com
- See below
3. Migrate pipeline staging to EC2
- Reduce our dependency on athq and oort
4. Hard-coded basic auth creds for services
5. Evolve v2 storage API
6. Evolve jobs
- Replace REST-based dispatch with message queue
@kevsmith
kevsmith / hangout
Created April 3, 2014 18:20
hangout shell script
#!/bin/sh
open "https://plus.google.com/hangouts/_/meet/$1"
[
%% SASL config
{sasl, [
{sasl_error_logger, {file, "/var/log/galactus/sasl-error.log"}},
{errlog_type, error},
{error_logger_mf_dir, "/var/log/galactus/sasl"}, % Log directory
{error_logger_mf_maxbytes, 10485760}, % 10 MB max file size
{error_logger_mf_maxfiles, 5} % 5 files max
]},