Skip to content

Instantly share code, notes, and snippets.

@ihrwein
ihrwein / .envrc
Created March 15, 2019 11:19
Running vessel-itinerary-domain-service on local dev machine
export APP_JWT_VERIFY_TOKEN="false"
export APP_OUTPUT_CONFIG="true"
export APP_LOG_LEVEL="DEBUG"
export APP_PRETTY_LOG_OUTPUT="true"
export APP_EXTERNAL_DATA_GATEWAY_ADDRESS="http://vessel-itinerary-domain-service-stubs:8001"
export APP_ELASTICSEARCH_ENABLE="true"
export APP_ELASTICSEARCH_HOST="localhost"
export APP_ELASTICSEARCH_PORT="9200"
export APP_ELASTICSEARCH_MAPPING_CONFIG="./infrastructure/data/mapping.json"
export APP_FEATURE_ADD_PORT_CALL="true"
@ihrwein
ihrwein / .vimrc
Created July 6, 2017 09:00
.vimrc
syntax on
set hlsearch
set expandtab
set tabstop=4
@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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