Skip to content

Instantly share code, notes, and snippets.

Working from my home in the Netherlands.

Petar Radošević wunki

Working from my home in the Netherlands.
View GitHub Profile
wunki /
Created Sep 15, 2015
closure within struct
extern crate iron;
use iron::prelude::{Request};
struct Resource {
is_available: fn(Request) -> bool
fn defaultResource() -> Resource {
Resource{is_available: |_| true}
View gist:188deb60699e90918340
// FindOne returns a single thread in the API
func (a *AppContext) FindOne(c *echo.Context) error {
id := c.P(0)
thread, err := a.ThreadStorage.FindOne(id)
if err != nil {
return c.JSON(http.StatusNotFound, nil)
return c.JSON(http.StatusOK, thread)
View gist:1d1a3c47349cf0edbadf
===> License MPL accepted by the user
===> Fetching all distfiles required by envconsul-0.5.0 for building
===> Extracting for envconsul-0.5.0
=> SHA256 Checksum OK for envconsul_0.5.0_freebsd_amd64.tar.gz.
=======================<phase: patch-depends >============================
=======================<phase: patch >============================
===> Patching for envconsul-0.5.0
wunki / gist:8373e1012374cd3ddd51
Created Feb 10, 2015
SSH configuration to get Consul web-ui from Vagrant
View gist:8373e1012374cd3ddd51
Host consulserver
Port 2222
IdentityFile /home/<username>/.vagrant.d/insecure_private_key
User vagrant
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LocalForward 8500 localhost:8500
wunki / wercker.yml
Created Feb 5, 2015
Build and deployment steps for Wercker.
View wercker.yml
box: wercker/golang
- setup-go-workspace
- script:
name: get dependencies
code: |
go get -t ./...
- script:
View anonymous-gist.yml
- script:
name: tar
code: tar -czf $WERCKER_OUTPUT_DIR/$WERCKER_GIT_REPOSITORY-$(git rev-parse --short=7).tar.gz $WERCKER_SOURCE_DIR
View anonymous-gist.el
;; configuration
(add-hook 'go-mode-hook
(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)))
wunki / anonymous-gist.clj
Created Dec 17, 2014
Get the last weeks in Clojure.
View anonymous-gist.clj
(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
View gist:6c56dc3e6e1cd943fd0e
Compiling plugin v0.0.0 (
src/ 25:44 error: cannot convert to a trait object because trait `Error` is not object-safe [E0038]
src/ 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/ 2:20 warning: lint missing_doc has been renamed to missing_docs
src/ #![deny(missing_doc)]
View gist:bcc7d059c41c95d3194b
### Keybase proof
I hereby claim:
* I am wunki on github.
* I am 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:
You can’t perform that action at this time.