- There is one system, not a collection of systems.
- The desired state of the system should be a known quantity.
- The "known quantity" must be machine parseable.
- The actual state of the system must self-correct to the desired state.
- The only authoritative source for the actual state of the system is the system.
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
# considered success? | |
systemctl status jenkins.service | |
jenkins.service - Jenkins CI Server | |
Loaded: loaded (/usr/local/lib/systemd/system/jenkins.service) | |
Active: inactive (dead) | |
Main PID: 3682 (code=killed, signal=TERM) | |
CGroup: name=systemd:/system/jenkins.service | |
# considered fail? | |
jenkins.service - Jenkins CI Server |
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
$ python | |
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) | |
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> def f(): | |
... try: | |
... raw_input("Read something:") | |
... except KeyboardInterrupt: | |
... print "A SIGINT HAPPENED!" | |
... sys.exit(0) |
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
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |
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
# This isn't perfect for high traffic sites, if you need something more production ready | |
# please tell us or stay tuned as we will open it up shortly. | |
import urllib | |
import urllib2 | |
import base64 | |
import simplejson | |
def track(event, properties=None): | |
""" |
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/bash | |
# Print a date string (rather path segment) with the last mtime of an input path | |
function format_mtime() { | |
p = $1 | |
_mtime=$(stat --format="%y" $p) | |
result=$(date -d "$_mtime" "+%Y/%Y-%m/%Y-%m-%d/%Y-%m-%d_%Hh") | |
return result | |
} |
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
d := time.Now() | |
b, _ := xml.Marshal(d) | |
fmt.Println() | |
fmt.Printf("%s\n", b) | |
fmt.Println() | |
Output is: <Time></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
"" MAGIC! call pathogen#infect() | |
syntax on | |
if has("autocmd") | |
filetype plugin indent on | |
endif | |
"" Variables | |
set nocompatible " Use Vim defaults (much better!) | |
set bs=2 " allow backspacing over everything in insert mode |
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
package main | |
// $ go version | |
//go version go1.0.2 | |
/// OUTPUT (made with echo test | nc -v -w 1 -4 -u 127.0.0.1 1234) | |
// 2012/06/24 16:22:47 @Received(1): "X" | |
// 2012/06/24 16:22:47 @Received(5): []byte{0x74, 0x65, 0x73, 0x74, 0xa} | |
// 2012/06/24 16:22:47 @Received(5): "test" |
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
# term 1 | |
$ go run udpreceiver.go -host localhost:1235 | |
2012/06/24 16:33:32 @Booting... | |
2012/06/24 16:33:32 @I need to listen here (flag): %s0xf840052240 | |
2012/06/24 16:33:32 @Trying to listen on (UDPAddr): %s127.0.0.1:1235 | |
2012/06/24 16:33:37 @Received(1): []byte{0x58} | |
2012/06/24 16:33:37 @Received(1): "X" | |
2012/06/24 16:33:37 @Received(1): []byte{0x58} | |
2012/06/24 16:33:37 @Received(1): "X" |
OlderNewer