Skip to content

Instantly share code, notes, and snippets.

View kafecho's full-sized avatar

Guillaume Belrose kafecho

View GitHub Profile
@kafecho
kafecho / gist:2ba793c53f1c0cb15eca
Created July 8, 2014 17:50
Ansible playbook to install CouchDB from source on CentOS 6.5
---
- hosts: cd-servers
gather_facts: no
sudo: true
user: deploy
tasks:
- name: Install Couchdb dependencies
yum: name={{ item }} state=installed
with_items:
- autoconf
@kafecho
kafecho / SdpParser.scala
Created September 5, 2014 16:47
Initial work on Scala parser combinators for reading sdp (session description protocol) files.
package org.kafecho.learning.parser
import scala.util.parsing.combinator.RegexParsers
import java.net.URI
sealed trait SdpValue
sealed trait Username
case class UserLogin(login: String) extends Username
case object UserIdsNotSupported extends Username
@kafecho
kafecho / local.ini
Created January 5, 2015 10:18
local.ini to customise the installation of CouchDB on a Windows server via Ansible.
[httpd]
bind_address = 0.0.0.0
@kafecho
kafecho / installcouchdb.ps1
Created January 8, 2015 07:46
Prototype Ansible playbook to install CouchDB and Silverlight on Windows nodes.
$p = Start-Process -FilePath "C:\Users\Guillaume\couchdb.exe" -ArgumentList "/VerySilent /CLOSEAPPLICATIONS /Log=C:\couchdb.txt" -Wait -PassThru
$p.WaitForExit()
if ($p.ExitCode -ne 0) {
throw "failed"
}
@kafecho
kafecho / mse.scala
Last active August 29, 2015 14:14
1st attempt at a ScalaJS / Media Source Extensions demo
/**
* Work in progress....
* Let's try to port Eric Bidelman's demo (http://html5-demos.appspot.com/static/media-source.html) to ScalaJS.
* This is mostly a learning exercise.
* Only tested on Google Chrome (on OS X Yosemite).
*/
package tutorial.webapp
import scala.scalajs.js.JSApp
---
- name: cache the rpms required to install HAProxy
shell: repotrack -p {{ rpms_root }} haproxy
---
- name: install HAProxy
shell: yum install -y haproxy --disablerepo=* --enablerepo=ansible
- name: customize HAProxy to serve HTTP traffic to the designated downstream servers
template: src=haproxy.cfg.j2 dest=/etc/haproxy/haproxy.cfg owner=haproxy group=haproxy
notify: restart_haproxy
- name: ensure HAProxy is started and enabled at boot time
service: name=haproxy state=started enabled=yes
[ansible]
name=Ansible
baseurl=http://{{ deployment_node_ip }}/rpms
enabled=1
gpgcheck=0
@kafecho
kafecho / enable-epel.yml
Created March 20, 2013 08:46
Ansible task file to enabled EPEL on CentOS.
---
- name: Downloading and enable the EPEL repository definitions.
action: command rpm -Uvh --replacepkgs http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
@kafecho
kafecho / gist:5232557
Created March 24, 2013 16:30
timeThis implementation
trait TimeUnit
case object msecs extends TimeUnit
case object nanosecs extends TimeUnit
object Watch{
/* A hashmap to map a time unit to a tuple containing:
* - a description of the time unit in english.
* - a function invoked to measure the time in the given unit
*/
val timeUnits = Map[TimeUnit,Tuple2[String,() => Long]] (
msecs -> ("msecs",System.currentTimeMillis _),