Skip to content

Instantly share code, notes, and snippets.

View panicbit's full-sized avatar
:shipit:
Ship it

panicbit

:shipit:
Ship it
  • Dortmund, Germany, ᐰ
View GitHub Profile
package wt2.notes.util;
import java.util.function.Supplier;
import java.util.NoSuchElementException;
import java.util.Optional;
public abstract class Result<T, E> {
public static <T, E> Ok<T, E> Ok(T value) {
return new Ok<T, E>(value);
}
use std::io::stdin;
fn main() {
let mut line = String::new();
loop {
let n_read = stdin().read_line(&mut line).unwrap();
println!("n_read: {}", n_read);
@panicbit
panicbit / main.rs
Last active January 11, 2017 14:18
Invert UTF8 QR-Codes
#![feature(io)]
use std::io::{stdin,Read};
fn translate(ch: char) -> char {
match ch {
' ' => '█',
'█' => ' ',
'▀' => '▄',
'▄' => '▀',
@panicbit
panicbit / foo.rs
Last active January 16, 2016 21:43
extern crate hyper;
extern crate rustc_serialize;
extern crate url;
use rustc_serialize::json::Json;
use url::Url;
use std::io::Read;
use hyper::Client;
// cargo-deps: nom="~1.0.0"
#[macro_use]
extern crate nom;
use nom::*;
use nom::IResult::*;
use std::str::{self, FromStr};
use std::iter::FromIterator;
use std::collections::HashMap;
match *last_song {
None => println!("No song"),
Some(ref blah) => println!("{:?}", blah)
}
#!/bin/bash
SUBREDDIT="winterporn"
MIN_WIDTH="1920"
MIN_HEIGHT="1080"
DLPATH="${HOME}/.cache/reddit_wallpaper"
if [ -z "$1" ]; then
NTH="0"
else
*int foo() {
int bar = 42;
return &bar;
}
#[derive(Debug,Eq,PartialEq)]
struct Foo;
fn main() {
println!("{:?}", Foo);
println!("{:?}", Foo == Foo);
}
use std::cell::RefCell;
thread_local!(static DIR: RefCell<String> = RefCell::new(String::new()));
fn main() {
DIR.with(|f| {
f.borrow_mut().push_str("foobar");
});
DIR.with(|f| {