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
@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;
@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 {
' ' => '█',
'█' => ' ',
'▀' => '▄',
'▄' => '▀',
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);
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);
}
extern crate cidr;
extern crate bitstring;
use cidr::{Ipv4Cidr,Cidr};
use bitstring::BitString;
fn main() {
let ip = "10.61.3.123".parse().unwrap();
let mut net = Ipv4Cidr::new_host(ip);
net.clip(24);
extern crate cidr;
use cidr::{Ipv4Inet,Inet};
fn main() {
let ip = "10.61.3.123".parse().unwrap();
let ip = Ipv4Inet::new(ip, 24).unwrap();
println!("{}", ip.network());
}
uniforms {
projection: [4; fvec4]
}
inputs {
inpos,
inclr
}
outputs {
let mut head = Node::new(vec[0].clone());
let mut current_head: &mut Node<T> = &mut head;
for &next in &vec[1..] {
let moved_head = current_head; // Takes the mutable reference away from current_head
moved_head.right = Some(Box::new(Node::new(next.clone())));
current_head = moved_head.right.as_mut().unwrap();
}
struct OptionIter<I> {
iter: Option<I>,
}
impl<I> Iterator for OptionIter<I>
where
I: Iterator,
{
type Item = Option<I::Item>;