Skip to content

Instantly share code, notes, and snippets.

View codification's full-sized avatar

Ville Svärd codification

  • Stockholm, SE
View GitHub Profile
@codification
codification / server.py
Created November 25, 2011 10:16
Python HTTP PUT test server
import sys
import signal
from threading import Thread
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
class PUTHandler(BaseHTTPRequestHandler):
def do_PUT(self):
print "----- SOMETHING WAS PUT!! ------"
print self.headers
length = int(self.headers['Content-Length'])
@codification
codification / DropdownBoxTest.java
Last active July 23, 2020 11:21
Selenium Test Angular Multiselect Dropdown
package tst;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.Wait;
@codification
codification / proc.clj
Created March 6, 2012 08:10
Clojure asynchronous process
(ns proc
(:import [java.lang ProcessBuilder])
(:use [clojure.java.io :only [reader writer]]))
(defn spawn [& args]
(let [process (-> (ProcessBuilder. args)
(.start))]
{:out (-> process
(.getInputStream)
(reader))
@codification
codification / graphite-client.py
Last active April 29, 2019 17:21
Graphite client in python
import time
import socket
def collect_metric(name, value, timestamp):
sock = socket.socket()
sock.connect( ("localhost", 2003) )
sock.send("%s %d %d\n" % (name, value, timestamp))
sock.close()
def now():
return int(time.time())
@codification
codification / docker-compose-haproxy-with-logging.yml
Created February 22, 2017 22:12
Docker haproxy with http logging through syslog proxying to local port (for debugging)
version: "2"
services:
rsyslog:
image: jumanjiman/rsyslog
proxy:
image: haproxy
volumes:
- ./:/cfg
volumes_from:
- rsyslog
@codification
codification / FirstTest.java
Last active February 3, 2018 13:19
Trying out closures as tests in Java8/junit5
import org.junit.jupiter.api.Assertions;
public class FirstTest extends FuncTest {
{{
describe("A test", () -> {
Assertions.assertTrue(() -> true);
});
describe("Another test", () -> {
@codification
codification / build.boot
Last active July 12, 2017 09:47
docker-for-aws in clojure using amazonica
(set-env!
:source-paths #{"src/clj"}
:resource-paths #{"resources"}
:dependencies '[[org.clojure/clojure "1.9.0-alpha14"]
[amazonica "0.3.78"]])
@codification
codification / conflicting.txt
Last active May 28, 2017 22:02
(Sometimes) Conflicting aspects of TDD
So.
First there was this, from @jbrains:
https://twitter.com/jbrains/status/868129015986618368
> There is more to #tdd than just writing the test first and looking
> for mistakes in the runtime behavior of the system.
Then there was this response from @gdinwiddie:
https://twitter.com/gdinwiddie/status/868279210963587073
> Yeah, but that's a good first step toward learning TDD.
! Xft settings ---------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
! URxvt settings ---------------------------------------------------------------
!URxvt*font: xft:Anonymous Pro:pixelsize=12:antialiasing=true
@codification
codification / clojure-intro.md
Last active December 16, 2015 00:39
Introduktioner till Clojure