Skip to content

Instantly share code, notes, and snippets.

@ihrwein
ihrwein / .envrc
Created Mar 15, 2019
Running vessel-itinerary-domain-service on local dev machine
View .envrc
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"
View .vimrc
syntax on
set hlsearch
set expandtab
set tabstop=4
@ihrwein
ihrwein / README.md
Last active Apr 8, 2020
Building minimal Rust containers with Docker multi stage builds
View README.md

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/
View 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 Feb 1, 2016
Rust Higher-rank lifetime example
View reactor.rs
// 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 Jan 5, 2016
getch() in Rust
View getch.rs
/*
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)
*/
View draft spec
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 Sep 18, 2015
Rust bindgen run on syslog-ng
View lib.rs
/* 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 Sep 2, 2015
syslog-ng OSE 3.7 debian repo
View 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 Aug 29, 2015
Syslog-ng with Python tf functions
View Output
I'm the function: host=localhost 1st arg=first_arg 2nd arg=second_arg
You can’t perform that action at this time.