Skip to content

Instantly share code, notes, and snippets.

(c-add-style "php-pear-k&r-mods" '("k&r"
(c-basic-offset . 4)
(c-offsets-alist . ((case-label . +)
(arglist-close . 0)
(inline-open . 0)))
(c-hanging-braces-alist . ((defun-open after)
(inline-open after)
(substatement-open after)))))
(add-hook 'php-mode-hook '(lambda ()
(message "setting style to php-pear")

Keybase proof

I hereby claim:

  • I am danajp on github.
  • I am danajp (https://keybase.io/danajp) on keybase.
  • I have a public key whose fingerprint is 8AB2 2F3C 33CB EC25 C94A D8ED 056F 3F7A D2D4 4848

To claim this, I am signing this object:

@danajp
danajp / rspec_and_yield_example.rb
Created April 17, 2015 20:28
Using RSpec Mocks' and_yield
class CSVOddUpcaser
# Pretty contrived, but whatever.
#
# Reads rows from a CSV object, upcases the data in the odd numbered
# rows and writes rows to a new CSV object.
def initialize(csv)
@csv = csv
end
@danajp
danajp / spreadsheet_validator_spec.rb
Created May 6, 2015 18:12
Using nested context blocks in rspec
class SpreadsheetValidator
def initialize(spreadsheet_reader)
@reader = spreadsheet_reader
@errors = []
end
def has_errors?
@errors.length > 0
end
@danajp
danajp / docker-compose.yml
Created March 29, 2016 01:48
Mesos/Marathon stack
# Docker compose config file. This will configure marathon for you in docker containers. Web consoles port
# numbers are:
#
# Marathon: 8080
# Mesos: 5050
# Zookeeper: 8082/exhibitor/v1/ui/index.html
#
# This file now requires that you have the DOCKER_IP environment
# variable present when you run `docker-compose up`. This should be
# set to the address of your docker virtual machine, or 'localhost' if
@danajp
danajp / load-credentials.py
Last active March 31, 2017 14:35
Load aws credentials into environment variables
#!/usr/bin/env python
from __future__ import print_function
import sys
try:
import ConfigParser as configparser
except ImportError:
import configparser
irb(main):001:0> require "kubeclient"
=> true
irb(main):002:0> config = Kubeclient::Config.read("/home/dana/.kube/config")
=> #<Kubeclient::Config:0x00560ede0bc528 ...>
irb(main):003:0> client = Kubeclient::Client.new(
irb(main):004:1* config.context.api_endpoint,
irb(main):005:1* config.context.api_version,
irb(main):006:1* {
irb(main):007:2* :ssl_options => config.context.ssl_options,
irb(main):008:2* :auth_options => config.context.auth_options
@danajp
danajp / kubectl-config.yaml
Last active May 23, 2017 18:40
[net http blog] kubectl config
apiVersion: v1
clusters:
- cluster:
certificate-authority: greenhouse-root-ca.pem
server: https://k8s.dev.use1.int.greenhouse.io
name: dev
- cluster:
certificate-authority: /home/dana/.minikube/ca.crt
server: https://192.168.99.100:8443
name: minikube
@danajp
danajp / irb.txt
Last active May 24, 2017 15:05
[net http blog] irb kubeclient
irb(main):001:0> require "kubeclient"
=> true
irb(main):002:0> config = Kubeclient::Config.read("/home/dana/.kube/config")
=> #<Kubeclient::Config:0x00560ede0bc528 ...>
irb(main):003:0> client = Kubeclient::Client.new(
irb(main):004:1* config.context("dev").api_endpoint,
irb(main):005:1* config.context("dev").api_version,
irb(main):006:1* {
irb(main):007:2* :ssl_options => config.context("dev").ssl_options,
irb(main):008:2* :auth_options => config.context("dev").auth_options
@danajp
danajp / kubectl.txt
Created May 23, 2017 18:44
[net http blog] kubectl
$ kubectl get service
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 172.28.0.1 <none> 443/TCP 138d