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
wunki / anonymous-gist.org
Created Oct 14, 2015
Run Ubuntu with iohyve
View anonymous-gist.org

Setup new server

  • iohyve create ubuntuguest 8G
  • iohyve set ubuntuguest loader=grub-bhyve
  • iohyve set ubuntuguest os=debian
  • iohyve set ubuntuguest ram=512M
  • iohyve set ubuntuguest cpu=2
  • iohyve set ubuntuguest con=nmdm1
  • iohyve install ubuntuguest ubuntu-14.04.3-server-amd64.iso
  • Drop in the console: iohyve console ubuntuguest
@wunki
wunki / Dockerfile
Created Oct 8, 2018
Continuous integration and deployment for a Clojure project on Gitlab
View Dockerfile
# Note, this dockerfile only works if you move the .jar
# file into the project directory first. This was done
# to get a clean, without any paths, artifact on Gitlab
FROM openjdk:8-jre-alpine
RUN mkdir -p /app /app/resources
WORKDIR /app
COPY *-standalone.jar .
COPY resources/pegasus/public .
CMD java -jar pegasus-0.1.0-SNAPSHOT-standalone.jar
View config.fish
function curl_time -d "Measure the response time for a given URL"
curl -so /dev/null -w "\
namelookup: %{time_namelookup}s\n\
connect: %{time_connect}s\n\
appconnect: %{time_appconnect}s\n\
pretransfer: %{time_pretransfer}s\n\
redirect: %{time_redirect}s\n\
starttransfer: %{time_starttransfer}s\n\
-------------------------\n\
total: %{time_total}s\n" $argv
@wunki
wunki / config
Last active Jun 28, 2018
Faster SSH connections by putting this in your `.ssh/config`. Don't forget to create the `~/.ssh/sockets` directory for it to work.
View config
Host *
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p
ControlPersist 600
@wunki
wunki / wercker.yml
Created Jun 20, 2013
Wercker deployment script for Clojure.
View wercker.yml
box: wercker/default
services:
- wercker/postgresql
- wercker/rabbitmq
- wercker/redis
build:
steps:
- script:
name: install clojure
code: |
View gist:61ddfd0f199c8f6318c57aef9922ef86
# Iceberg color scheme.
[colors]
foreground = #d2d4de
background = #161821
foreground_bold = #d2d4de
cursor = #d2d4de
cursor_foreground = #161821
highlight = #6b7089
# black
View lib.rs
use std::collections::HashMap;
type CharCount = HashMap<char, u16>;
fn word_to_hashmap(word: &str) -> CharCount {
let mut charcount = HashMap::new();
for c in word.chars() {
let c = c.to_lowercase().next().unwrap();
let count = charcount.entry(c).or_insert(0);
*count += 1;
View gist:887f705316fd2dff351a
~/.e/omnisharp-roslyn (master✓) ./build.sh
dnvm is already installed in /Users/wunki/.dnx/dnvm, trying to update
=> Source string already in /Users/wunki/.bash_profile
Type 'source /Users/wunki/.dnx/dnvm/dnvm.sh' to start using dnvm
Downloading dnvm.sh from https://raw.githubusercontent.com/aspnet/Home/dev/dnvm.sh
######################################################################## 100.0%
Default unstable feed (https://www.myget.org/F/aspnetvnext/api/v2) is being overridden by the value of the DNX_UNSTABLE_FEED variable (https://www.myget.org/F/aspnetcidev/api/v2).
dnx-mono.1.0.0-rc2-16444 already installed in /Users/wunki/.dnx
Adding /Users/wunki/.dnx/runtimes/dnx-mono.1.0.0-rc2-16444/bin to process PATH
@wunki
wunki / compression.clj
Created Jan 26, 2014
Most simple form of string compression.
View compression.clj
(defn string-compression
"Compresses a string by appending the count after the repeat of each
letter. For example: \"aabccccaaa\" would become \"a2b1c4a3\".
If the compressed string is larger than the original, it should return the
original."
[s]
(let [cnt-orig (count s)
compress-fn (fn [coll c]
(if (empty? coll)
View gist:6896949
(defun wunki-folder-for-account (folder)
"Returns the correct folder for this account"
(lambda (msg)
(if msg
(let ((account (nth 1 (split-string (mu4e-message-field msg :maildir) "/"))))
(format "%s/%s" account folder)))))
You can’t perform that action at this time.