Skip to content

Instantly share code, notes, and snippets.

@joergrathlev
joergrathlev / main.rs
Created January 25, 2018 20:14
rust meetup 2018-01-25
#![feature(plugin)]
#![plugin(rocket_codegen)]
extern crate rocket;
extern crate ipnetwork;
use ipnetwork::{IpNetwork, IpNetworkError};
use rocket::http::RawStr;
use rocket::request::FromParam;
use std::error::Error;
@joergrathlev
joergrathlev / Demo.java
Created June 23, 2015 21:06
The IO monad (or something similar) in Java
import java.util.function.Function;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class Demo {
/**
* An IO operation that results in a value of type T.
@joergrathlev
joergrathlev / gist:a697b7d74de8a404e81a
Created February 24, 2015 14:50
Convenience Bash function to connect to a server by its Ansible name
function ssha () {
if [ $# -eq 0 ]
then
echo "Usage: ssha <ansible-hostname> [ssh arguments]" >&2
return 1
fi
local inventory=/path/to/your/inventory # CHANGE THIS LINE
local ansible_name="$1"
shift