Skip to content

Instantly share code, notes, and snippets.

View yuriks's full-sized avatar

Yuri Kunde Schlesner yuriks

View GitHub Profile
@yuriks
yuriks / playground.rs
Created April 17, 2017 06:01 — forked from anonymous/playground.rs
Shared via Rust Playground
const TEST_DATA : &'static str = "Device: ID=1; Fw=16071801; Evt=2; Alarms: CoilRevesed=OFF; Power: Active=1753W; Reactive=279var; Appearent=403VA; Line: Current=7.35900021; Voltage=230.08V; Phase=-43,841rad; Peaks: 7.33199978;7.311999799999999;7.53000021;7.48400021;7.54300022;7.62900019;7.36499977;7.28599977;7.37200022;7.31899977; FFT Re: 9748;46;303;33;52;19;19;39;-455; FFT Img: 2712;6;-792;-59;1386;-19;963;33;462; UTC Time: 2016-10-4 16:47:50; hz: 49.87; WiFi Strength: -62; Dummy: 20";
fn partition(s: &str) -> (&str, Option<char>, &str) {
const TOKEN_SEPARATORS : &'static [char] = &[':', '=', ';'];
let idx = s.find(TOKEN_SEPARATORS).unwrap_or(s.len());
let (head, tail) = s.split_at(idx);
let mut tail_it = tail.chars();
let separator = tail_it.next();
(head, separator, tail_it.as_str())
@yuriks
yuriks / playground.rs
Created April 17, 2017 06:01 — forked from anonymous/playground.rs
Shared via Rust Playground
const TEST_DATA : &'static str = "Device: ID=1; Fw=16071801; Evt=2; Alarms: CoilRevesed=OFF; Power: Active=1753W; Reactive=279var; Appearent=403VA; Line: Current=7.35900021; Voltage=230.08V; Phase=-43,841rad; Peaks: 7.33199978;7.311999799999999;7.53000021;7.48400021;7.54300022;7.62900019;7.36499977;7.28599977;7.37200022;7.31899977; FFT Re: 9748;46;303;33;52;19;19;39;-455; FFT Img: 2712;6;-792;-59;1386;-19;963;33;462; UTC Time: 2016-10-4 16:47:50; hz: 49.87; WiFi Strength: -62; Dummy: 20";
fn partition(s: &str) -> (&str, Option<char>, &str) {
const TOKEN_SEPARATORS : &'static [char] = &[':', '=', ';'];
let idx = s.find(TOKEN_SEPARATORS).unwrap_or(s.len());
let (head, tail) = s.split_at(idx);
let mut tail_it = tail.chars();
let separator = tail_it.next();
(head, separator, tail_it.as_str())
@yuriks
yuriks / fs_user.patch
Created November 5, 2014 02:37 — forked from anonymous/-
diff --git a/src/core/hle/service/fs_user.cpp b/src/core/hle/service/fs_user.cpp
index 0ff9570..0e83a18 100644
--- a/src/core/hle/service/fs_user.cpp
+++ b/src/core/hle/service/fs_user.cpp
@@ -23,6 +23,23 @@ enum class LowPathType : u32 {
Wchar = 4
};
+u64 FS_Path::as_empty() {
+ return 0;
@yuriks
yuriks / gist:1251653
Created September 29, 2011 19:15 — forked from dennda/gist:1251646
uint8* dest = malloc(width * height * 4);
short* src = imgData;
for (int i = 0; i < width * height; ++i) {
short x = *src++;
*dest++ = (x >> 8) & 0xFF;
*dest++ = x & 0xFF;
*dest++ = 0;
*dest++ = 0;
}