Skip to content

Instantly share code, notes, and snippets.

View mwiewior's full-sized avatar

Marek Wiewiórka mwiewior

View GitHub Profile
@gz
gz / files.rs
Created February 4, 2023 07:08
some ways to read files in rust, mmap is fastest
use std::time::Instant;
use std::fs::File;
use std::io::{self, prelude::*, BufReader};
let file = File::open("examples/WDC_tickbidask.csv")?;
let mut reader = BufReader::new(file);
let mut line = String::new();
let mut lines = 0;
let start = Instant::now();
while reader.read_line(&mut line).unwrap() > 0 {
import sklearn
import numpy as np
import math
import pickle
import collections
class DGA:
def __init__(self):
self.model = { 'clf': pickle.loads(open('./dga_model_random_forest.model','rb').read())
, 'alexa_vc': pickle.loads(open('./dga_model_alexa_vectorizor.model','rb').read())
, 'alexa_counts': pickle.loads(open('./dga_model_alexa_counts.model','rb').read())
@WarFox
WarFox / scala-sbt-project-structure.sh
Last active June 1, 2018 16:15
Script to create Scala SBT project directory structure
#!/usr/bin/env bash
touch build.sbt ; touch README.md; mkdir -p project; touch project/plugins.sbt; mkdir -p src/{main/{scala,resources,java},test/{scala,resources,java}}/
@nogweii
nogweii / Test.java
Created October 1, 2013 23:39
A quick test to see if you have the JCE Unlimited Strength Jurisdiction Policy files installed. If you don't, in Java 6 you'll see 128. If you do, you'll see 2147483647. Thanks to http://stackoverflow.com/questions/11538746/check-for-jce-unlimited-strength-jurisdiction-policy-files
import javax.crypto.Cipher;
class Test {
public static void main(String[] args) {
try {
System.out.println("Hello World!");
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
System.out.println(maxKeyLen);
} catch (Exception e){
System.out.println("Sad world :(");