This file contains hidden or 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
fn sign(req: RequestWriter, path: &Path) -> String { | |
let mut hmac = hmac::Hmac::new(sha1::Sha1::new(), "foo".as_bytes()); | |
string_to_sign(hmac, req, path); | |
hmac.result().code().to_base64(URL_SAFE) | |
} | |
// See: http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html | |
// The string to sign consists of the following data: | |
// StringToSign = HTTP-Verb + "\n" + | |
// Content-MD5 + "\n" + |
This file contains hidden or 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 | |
import ( | |
"database/sql" | |
"encoding/json" | |
"fmt" | |
"log" | |
"os" | |
"os/signal" | |
"syscall" |
This file contains hidden or 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
readers_last_week = Reader.objects\ | |
.filter(completed_at__range=(previous_monday, | |
previous_sunday)).count()\ | |
.distinct('user')\ | |
.count() |
This file contains hidden or 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
### Keybase proof | |
I hereby claim: | |
* I am wunki on github. | |
* I am wunki (https://keybase.io/wunki) on keybase. | |
* I have a public key whose fingerprint is 208E 44AC DB1D 9CBC AF02 DEF8 91A2 3B2C 3809 EEAF | |
To claim this, I am signing this object: |
This file contains hidden or 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
Compiling plugin v0.0.0 (https://github.com/reem/rust-plugin.git#9564d448) | |
src/lib.rs:25:36: 25:44 error: cannot convert to a trait object because trait `Error` is not object-safe [E0038] | |
src/lib.rs:25 fn erase(self) -> Box<Error> { box self as Box<Error> } | |
^~~~~~~~ | |
note: cannot call a method (`unwrap`) with a by-value receiver through a trait object | |
note: cannot call a method (`erase`) with a by-value receiver through a trait object | |
error: aborting due to previous error | |
Build failed, waiting for other jobs to finish... | |
src/lib.rs:2:9: 2:20 warning: lint missing_doc has been renamed to missing_docs | |
src/lib.rs:2 #![deny(missing_doc)] |
This file contains hidden or 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
(defn get-weeks [n] | |
"Returns a vector of dictionaries containing the start and end days of the last n weeks" | |
(let [now (t/today-at-midnight) | |
this-day-num (Integer. (f/unparse (f/formatter "e") now)) | |
last-monday (t/minus now (t/days (dec this-day-num))) | |
span-fn (fn [v w] | |
(let [monday (t/minus last-monday (t/weeks w)) | |
sunday (t/plus monday (t/days 7)) | |
week (Integer. (f/unparse (f/formatter "w") monday))] | |
(conj v {:week week |
This file contains hidden or 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
;; configuration | |
(add-hook 'go-mode-hook | |
'(lambda() | |
(setq c-basic-offset 4) | |
(setq tab-width 4) | |
(setq indent-tabs-mode t) | |
(local-set-key (kbd "M-.") 'godef-jump) | |
(local-set-key (kbd "C-c C-r") 'go-remove-unused-imports) | |
(local-set-key (kbd "C-c i") 'go-goto-imports) | |
(local-set-key (kbd "C-c d") 'godoc))) |
This file contains hidden or 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
deploy: | |
steps: | |
- script: | |
name: tar | |
code: tar -czf $WERCKER_OUTPUT_DIR/$WERCKER_GIT_REPOSITORY-$(git rev-parse --short=7).tar.gz $WERCKER_SOURCE_DIR |
This file contains hidden or 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
box: wercker/golang | |
build: | |
steps: | |
- setup-go-workspace | |
- script: | |
name: get dependencies | |
code: | | |
cd $WERCKER_SOURCE_DIR | |
go get -t ./... | |
- script: |
This file contains hidden or 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
Host consulserver | |
Hostname 127.0.0.1 | |
Port 2222 | |
IdentityFile /home/<username>/.vagrant.d/insecure_private_key | |
User vagrant | |
StrictHostKeyChecking no | |
UserKnownHostsFile /dev/null | |
LocalForward 8500 localhost:8500 |