Skip to content

Instantly share code, notes, and snippets.

@ihrwein
ihrwein / syslog-ng-docker.md
Created July 20, 2015 11:01
Some thoughts about our Docker images

When we started to create our own Docker images we didn't have much experience in this area. I think our current solution solves many problems but leaves one problem open: it's too complex. It it good for our first try, we learned many things from it and got a lot of useful preliminary work on our Docker images but I think we should move on.

Base images

What I expect as an user

When I try to use some software through Docker I visit Docker Hub and search for a name: syslog-ng. I don't care what's the underlying operating system I'm only interested in the software.

If I want to use a specific version I expect to work the following commands:

@ihrwein
ihrwein / Output
Last active August 29, 2015 14:27
Syslog-ng with Python tf functions
I'm the function: host=localhost 1st arg=first_arg 2nd arg=second_arg
@ihrwein
ihrwein / syslog-ng OSE 3.7 debian repo
Created September 2, 2015 07:24
syslog-ng OSE 3.7 debian repo
wget -qO - http://download.opensuse.org/repositories/home:/laszlo_budai:/syslog-ng/Debian_8.0/Release.key | apt-key add -
echo 'deb http://download.opensuse.org/repositories/home:/laszlo_budai:/syslog-ng/Debian_8.0 ./' >> /etc/apt/sources.list.d/syslog-ng-obs.list
@ihrwein
ihrwein / lib.rs
Created September 18, 2015 19:29
Rust bindgen run on syslog-ng
/* automatically generated by rust-bindgen */
pub type ptrdiff_t = ::libc::c_long;
pub type size_t = ::libc::c_ulong;
pub type wchar_t = ::libc::c_int;
pub type gint8 = ::libc::c_char;
pub type guint8 = ::libc::c_uchar;
pub type gint16 = ::libc::c_short;
pub type guint16 = ::libc::c_ushort;
pub type gint32 = ::libc::c_int;
@ihrwein
ihrwein / draft spec
Created September 25, 2015 08:59
Torpedo jatek
A feladat celja egy korokre osztott halozati torpedo jatek keszitese szoveges
felhasznalo interfesszel. A torpedo jatekot ket fel jatssza egymas ellen. A
szerver egyszerre tobb parhuzamos jatekot is tamogat, melynek maximalis szamat
forditas idoben lehet megadni.
A jatekok futasahoz eloszor a szervert kell elinditani, mely egy adott TCP
porton varja a kliensek csatlakozasat. Miutan ket jatekra varo kliens is
cs
@ihrwein
ihrwein / getch.rs
Last active January 5, 2016 19:49
getch() in Rust
/*
1. copy getch() into getch.c from here: http://stackoverflow.com/a/912796/3989982
2. compile getch.c with: gcc -o libgetch.so -shared -fPIC getch.c
3. create getch.rs with the below content
4. compile getch.rs: rustc -L. getch.rs
5. run it: LD_LIBRARY_PATH=. ./getch
You can extract these steps into a build script (or someone can make a platform independent getch based on this)
*/
@ihrwein
ihrwein / reactor.rs
Created February 1, 2016 16:55
Rust Higher-rank lifetime example
// D is some data shared among event handlers
pub trait EventHandler<D> {
fn handle_event(&mut self, &mut D);
}
pub struct EH;
impl<'a> EventHandler<Data<'a>> for EH {
fn handle_event(&mut self, data: &mut Data<'a>) {
println!("{}", data._d1);
@ihrwein
ihrwein / trie.rs
Created January 24, 2017 21:51 — forked from ayende/trie.rs
extern crate alloc;
extern crate libc;
use std::mem;
use std::ptr;
pub struct Trie {
data: alloc::raw_vec::RawVec<u8>,
}
@ihrwein
ihrwein / README.md
Last active September 26, 2021 16:59
Building minimal Rust containers with Docker multi stage builds

The built image for a hello world project is less than 8 MB.

Builder image (it'd be best to upload this image to Docker Hub. This is 100% percent reusable).

FROM ubuntu:latest

ENV TARGET=x86_64-unknown-linux-musl
ENV BUILD_DIR=/src/target/x86_64-unknown-linux-musl/release/
@ihrwein
ihrwein / .vimrc
Created July 6, 2017 09:00
.vimrc
syntax on
set hlsearch
set expandtab
set tabstop=4