Skip to content

Instantly share code, notes, and snippets.

View tobstarr's full-sized avatar

Tobias Schwab tobstarr

View GitHub Profile
class SystemProcess
def initialize(pid)
@pid = pid
end
def started_at
self.class.time_of_boot + started_seconds_after_boot
end
class << self
ping -c 20 rpm.newrelic.com
PING rpm.newrelic.com (204.93.223.152): 56 data bytes
64 bytes from 204.93.223.152: icmp_seq=0 ttl=243 time=126.194 ms
64 bytes from 204.93.223.152: icmp_seq=1 ttl=243 time=127.827 ms
64 bytes from 204.93.223.152: icmp_seq=2 ttl=243 time=129.254 ms
Request timeout for icmp_seq 3
64 bytes from 204.93.223.152: icmp_seq=4 ttl=243 time=125.912 ms
Request timeout for icmp_seq 5
64 bytes from 204.93.223.152: icmp_seq=6 ttl=243 time=126.097 ms
Request timeout for icmp_seq 7
@tobstarr
tobstarr / README.md
Last active December 18, 2015 22:49
Prime Tests

1048576 should be around 30 seconds for ruby 1.9.3p327

root@tobstarr002:~# docker build -t test - << EOF
> FROM ubuntu
> RUN echo 1
> EOF
Uploading context 2048 bytes
Step 1 : FROM ubuntu
---> 8dbd9e392a96
Step 2 : RUN echo 1
---> Running in 3756c0b5a3f9
---> 303730c5adc4
require "yaml"
require "awesome_print"
ap YAML.load(DATA.read)
__END__
a:
name: John
email: [email protected]
@tobstarr
tobstarr / Dockerfile
Last active November 2, 2018 18:05
Jenkins for go projects with docker
FROM ubuntu:12.04
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-6-jdk curl git-core build-essential bzr
RUN mkdir -p /tmp/downloads
# install go
RUN curl -sf -o /tmp/downloads/go1.1.1.linux-amd64.tar.gz -L https://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz
RUN mkdir -p /opt && cd /opt && tar xfz /tmp/downloads/go1.1.1.linux-amd64.tar.gz
# install jenkins
RUN curl -sf -o /opt/jenkins-1.523.war -L http://mirrors.jenkins-ci.org/war/1.523/jenkins.war
require "socket"
require "time"
require "syslog/logger"
module Syslog
class UDPLogger < Logger
attr_reader :socket
def initialize(tag, host = "127.0.0.1", port = 514)
@host = host
@tobstarr
tobstarr / Dockerfile
Last active December 20, 2015 00:49
FROM ubuntu
RUN sed 's/main$/main universe/' -i /etc/apt/sources.list && apt-get update
RUN apt-get install -y git-core python-pip build-essential python-dev libevent1-dev -y
RUN git clone https://github.com/dotcloud/docker-registry.git /docker-registry
RUN cd /docker-registry && pip install -r requirements.txt
RUN cp /docker-registry/config_sample.yml /docker-registry/config.yml
EXPOSE 5000
@tobstarr
tobstarr / Makefile
Created July 22, 2013 10:15
Golang SSH client
default:
@go get code.google.com/p/go.crypto/ssh
go build -o bin/test_ssh_client *.go
@tobstarr
tobstarr / Dockerfile
Last active December 20, 2015 14:29
Dockerfile for running OpenTSDB
FROM ubuntu
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl build-essential git-core
RUN if [ ! $(grep universe /etc/apt/sources.list) ]; then sed 's/main$/main universe/' -i /etc/apt/sources.list && apt-get update; fi
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-6-jdk
RUN mkdir -p /opt/downloads && cd /opt/downloads && curl -SsfLO "http://www.apache.org/dist/hbase/hbase-0.94.10/hbase-0.94.10.tar.gz"
RUN cd /opt && tar xvfz /opt/downloads/hbase-0.94.10.tar.gz
RUN mkdir -p /data/hbase
RUN mkdir -p /root/.profile.d
RUN mkdir -p /root && echo Zm9yIHByb2ZpbGVfcGF0aCBpbiAkKGZpbmQgL3Jvb3QvLnByb2ZpbGUuZC8gLXR5cGUgZik7IGRvIHNvdXJjZSAkcHJvZmlsZV9wYXRoOyBkb25lCg== | base64 -d > /tmp/wunderscale.e4e4b9a9fbb0a7813a4707407606ccb195999effc1d27eac75a879113a4a017b && mv /tmp/wunderscale.e4e4b9a9fbb0a7813a4707407606ccb195999effc1d27eac75a879113a4a017b /root/.profile
RUN mkdir -p /root/.profile.d && echo ZXhwb3J0IEpBVkFfSE9NRT0vdXNyL2xpYi9qdm0vamF2YS02LW9wZW5qZGstYW1kNjQK | base64 -d > /tmp/wundersc