Skip to content

Instantly share code, notes, and snippets.

View zzeroo's full-sized avatar
💤
zzeroo...

zzeroo zzeroo

💤
zzeroo...
View GitHub Profile
@zzeroo
zzeroo / mut_move.rs
Created September 2, 2016 08:57
Mutable after move
extern crate gtk;
use gtk::prelude::*;
#[derive(Clone)]
struct Client {
error_counter: i32,
}
impl Client {
fn new() -> Self {
/// Cargo.toml
/// [dependencies]
/// gtk = { git = "https://github.com/gtk-rs/gtk", features = ["v3_10"] }
/// gdk = { git = "https://github.com/gtk-rs/gdk" }
extern crate gdk;
extern crate gtk;
use gdk::enums::*;
use gtk::prelude::*;
@zzeroo
zzeroo / shift_in.rs
Created April 18, 2016 10:31 — forked from anonymous/playground.rs
Shared via Rust Playground
#[derive(Debug,PartialEq)]
enum Bitorder {
LSBFIRST,
MSBFIRST,
}
fn main() {
let order: Bitorder = Bitorder::LSBFIRST;
if order == Bitorder::MSBFIRST {
#include <wiringPi.h>
#define OE 31
#define DS_DATA_IN 33
#define SH_CLOCK 35
#define ST_LATCH 37
void latch_out() {
// Latch out
@zzeroo
zzeroo / playground.rs
Created March 21, 2016 19:28 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::collections::HashMap;
fn nucleotide_counts(nucleotides: &str) -> HashMap<char, usize> {
let mut nucleotide = HashMap::new();
for n in nucleotides.chars() {
let counter = nucleotide.entry(n) // gets the given key's corrosponding entry in the map for in-place manipulation
.or_insert(0); // ..or insert 0 if its not present already
*counter += 1; // Now increment the entry, so it's 1 for all new keys or plus one for all other.
}
nucleotide
@zzeroo
zzeroo / playground.rs
Created March 17, 2016 07:30 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::collections::HashMap;
fn create_hashmap(strand_a: &str, strand_b: &str) -> HashMap<char, char> {
let strand_a: Vec<_> = strand_a.chars().collect();
let strand_b: Vec<_> = strand_b.chars().collect();
strand_a.iter().zip(strand_b.iter()).map(|(&a, &b)| (a, b)).collect()
}
fn main() {
{{velocity}}
{{documentTree root="document:$doc" /}}
{{/velocity}}
@zzeroo
zzeroo / bareos-sd
Created January 4, 2016 10:55
bareos-sd -u bareos -g bareos -d 300 # startet by hand
bareos-sd (90): stored_conf.c:845-0 Inserting Director res: linux01-mon
bareos-sd (90): stored_conf.c:845-0 Inserting Device res: usb-vchanger-1-drive-0
bareos-sd (90): stored_conf.c:845-0 Inserting Device res: usb-vchanger-1-drive-1
bareos-sd (250): message.c:349-0 Copy message resource 779658 to 79c468
linux01-sd (100): jcr.c:141-0 read_last_jobs seek to 192
linux01-sd (100): jcr.c:148-0 Read num_items=4
linux01-sd (8): crypto_cache.c:55-0 Could not open crypto cache file. /var/lib/bareos/bareos-sd.9103.cryptoc ERR=Datei oder Verzeichnis nicht gefunden
linux01-sd (250): sd_plugins.c:322-0 Load sd plugins
linux01-sd (250): sd_plugins.c:324-0 No sd plugin dir!
linux01-sd (10): socket_server.c:112-0 stored: listening on port 9103
bareos-sd (90): stored_conf.c:845-0 Inserting Director res: linux01-mon
bareos-sd (90): stored_conf.c:845-0 Inserting Device res: usb-vchanger-1-drive-0
bareos-sd (90): stored_conf.c:845-0 Inserting Device res: usb-vchanger-1-drive-1
bareos-sd (250): message.c:349-0 Copy message resource 779658 to 79c468
linux01-sd (100): jcr.c:141-0 read_last_jobs seek to 192
linux01-sd (100): jcr.c:148-0 Read num_items=4
linux01-sd (8): crypto_cache.c:55-0 Could not open crypto cache file. /var/lib/bareos/bareos-sd.9103.cryptoc ERR=Datei oder Verzeichnis nicht gefunden
linux01-sd (250): sd_plugins.c:322-0 Load sd plugins
linux01-sd (250): sd_plugins.c:324-0 No sd plugin dir!
linux01-sd (10): socket_server.c:112-0 stored: listening on port 9103
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://piwik.gaswarnanlagen.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);