Skip to content

Instantly share code, notes, and snippets.

@XMPPwocky
XMPPwocky / oldbf.rs
Created November 24, 2015 16:48
oldbeef
extern crate threadpool;
struct Rng {
state: (u32, u32)
}
fn conv_to_double_old(a: u32) -> f64 {
let prefab = 0x4130_0000_0000_0000u64;
let ugly = (a as u64) | prefab;
let (val, subtract) = unsafe {
(std::mem::transmute::<u64, f64>(ugly),
std::mem::transmute::<u64, f64>(prefab))
extern crate threadpool;
struct Rng {
state: (u32, u32)
}
impl Rng {
fn random(&mut self) -> f64 {
let r0 = (18273 * (self.state.0 & 0xFFFF)) + (self.state.0 >> 16);
self.state.0 = r0;
let r1 = (36969 * (self.state.1 & 0xFFFF)) + (self.state.1 >> 16);
self.state.1 = r1;
33.99689677171409
44.9135547503829
99.60644023958594
18.86737383902073
65.58512230403721
18.061140808276832
34.19852613005787
05.054796161130071
55.99670028313994
01.3014044612646103
63.46775421407074
29.78667449206114
93.39579278603196
29.625516454689205
68.20552437566221
90.98819722421467
44.9135547503829
18.86737383902073
18.061140808276832
05.054796161130071
extern crate threadpool;
struct Rng {
state: (u32, u32)
}
impl Rng {
fn random(&mut self) -> f64 {
let r0 = (18273 * (self.state.0 & 0xFFFF)) + (self.state.0 >> 16);
self.state.0 = r0;
let r1 = (36969 * (self.state.1 & 0xFFFF)) + (self.state.1 >> 16);
self.state.1 = r1;
import os
import random
import struct
while True:
src = open("source.vtf", "rb")
f = open("test.vtf", "wb")
word = src.read(4)
while len(word) == 4:
word = struct.unpack("I", word)[0]

Keybase proof

I hereby claim:

  • I am xmppwocky on github.
  • I am xmppwocky (https://keybase.io/xmppwocky) on keybase.
  • I have a public key whose fingerprint is 5143 ABA8 C47B B9C2 8D79 FF60 CCB2 D624 C67D CAC2

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am xmppwocky on github.
* I am xmppwocky (https://keybase.io/xmppwocky) on keybase.
* I have a public key whose fingerprint is 7F37 19F2 18CA A121 20BE E684 8F43 F708 DC61 09C3
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am xmppwocky on github.
  • I am xmppwocky (https://keybase.io/xmppwocky) on keybase.
  • I have a public key whose fingerprint is 068C 2D77 B289 FC77 5523 E5FC 4592 B7D1 7019 ACA3

To claim this, I am signing this object:

extern crate iron;
extern crate router;
extern crate logger;
use iron::prelude::*;
use iron::status;
const SITEADDRESS: &'static str = "localhost:3000";
fn main() {