Skip to content

Instantly share code, notes, and snippets.

@arkadijs
arkadijs / shmdump.c
Created February 24, 2015 07:29
Dump SYSV shared memory segment to stdout
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <sys/shm.h>
int main(int argc, char**argv)
{
void *shm;
@arkadijs
arkadijs / dv2v4l2.md
Last active August 29, 2015 14:15
HDV FireWire camcoder for Google Hangouts / V4L2 / WebRTC

HDV FireWire camcoder for Google Hangouts / V4L2 / WebRTC

Core i7 class CPU recommended.

On Ubuntu Linux 14.04, install v4l2loopback driver from repository:

apt-get install -y v4l2loopback-dkms v4l2loopback-utils

..or from latest sources:

@arkadijs
arkadijs / .gitignore
Last active August 29, 2015 14:11
Workshop: Automated deployment with Fabric http://ldn.lv/events/202676852
*.pyc
@arkadijs
arkadijs / docker.service
Last active August 29, 2015 14:10
Docker with Flannel overlay network
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
After=docker.socket
Requires=docker.socket
Requires=flannel.service
After=flannel.service
[Service]
Environment="TMPDIR=/var/tmp/"
def zookeeper: Future[Map[String, String]] = async {
val writeback = ZooKeeper.WritebackPathPrefix.split("/").filterNot(_.isEmpty).toSeq
def join(l: Seq[String]) = l.mkString("/")
def nodes(parent: Seq[String], node: String): Seq[Seq[String]] = {
(parent :+ node) match {
case `writeback` => Seq()
case path => path +: ZooKeeper.getChildren(join(path)).flatMap(node => nodes(path, node))
}
}
nodes(Seq(), services.ZooKeeperService.BasePath.stripPrefix("/"))
@arkadijs
arkadijs / pypy-bootstrap.sh
Created November 23, 2014 20:29
PyPy bootstrap from sources on Debian
#!/bin/sh
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y \
gcc g++ make python-dev libffi-dev libsqlite3-dev pkg-config \
libz-dev libbz2-dev libncurses-dev libexpat1-dev \
libssl-dev libgc-dev python-sphinx python-greenlet \
time less htop bzip2 unzip zip git mercurial nano rsync vim
sudo apt-get clean
wget https://bitbucket.org/pypy/pypy/downloads/pypy-2.2.1-src.tar.bz2
@arkadijs
arkadijs / _README.md
Last active August 29, 2015 14:09
Global Day of Coderetreat 2014, Riga, Latvia http://ldn.lv/events/209047582
@arkadijs
arkadijs / sse.scala
Last active August 29, 2015 14:09
Server-sent events in Play2 / Iteratee for Hystrix console
import play.api.libs.concurrent._
import play.api.libs.concurrent.Execution.Implicits._
import play.api.libs.iteratee._
import scala.concurrent.duration._
def circuitBreakers = Action {
Ok.stream(Enumerator.generateM {
val promise = Promise[String]()
Akka.system.scheduler.scheduleOnce(1 second) {
promise.completeWith(circuitBreakers)

Docker

Docker-enabled environment

Cloud

ssh -i workshop.pem ubuntu@lxc-1-01.eu.r53.acp.io

Replace 01 in lxc-1-01 with index assigned to you. Download workshop key below.

@arkadijs
arkadijs / install.md
Last active January 6, 2022 17:10
GitLab in LXC on Ubuntu and openSUSE

Ubuntu host and container

Install LXC:

apt-get install linux-hwe-generic # update to 3.13 on Precise
apt-add-repository ppa:ubuntu-lxc/stable
apt-get update
apt-get install lxc lxc-templates cgmanager cgroup-lite
reboot