Skip to content

Instantly share code, notes, and snippets.

View AngelicosPhosphoros's full-sized avatar

AngelicosPhosphoros

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AngelicosPhosphoros
AngelicosPhosphoros / DerivativesKhuzin.ipynb
Last active October 15, 2018 21:47
HW from MIEM: Derivatives
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
starts = ['binaries', 'Source', 'Config', 'Content']
import os
import os.path as path
def get_file_data(filepath):
if path.isfile(filepath):
sz = path.getsize(filepath)
#print("For %s is %d"%(filepath, sz))
return filepath, sz
@AngelicosPhosphoros
AngelicosPhosphoros / Timur Khuzin HW HMM.ipynb
Last active March 12, 2019 20:45
Homework about Hidden Markov Models
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python3
W_DIR = 'data/save'
BEGIN_PATTERN = 'region3'
ZIP_EXECUTABLE = 'C:/Program Files/7-Zip/7z.exe'
OUT_PUT_PATH = 'E:/Games/DF/Backups'
import os
import os.path
import subprocess
@AngelicosPhosphoros
AngelicosPhosphoros / Comparison
Created December 1, 2019 15:16
TCP vs HTTP server
http local
In 60.0000814 seconds we received 665953 responses and 0 errors
Mean 11099.201608749818 requests/sec
http remote
In 60.0109771 seconds we received 1224 responses and 0 errors
Mean 20.396268468689872 requests/sec
tcp nodelay local
In 60.0000037 seconds we received 3152850 responses and 0 errors
@AngelicosPhosphoros
AngelicosPhosphoros / Rust circular move using unsafe Hole.rs
Created February 25, 2020 13:57
Rust circular move using unsafe Hole
use std::cmp::{Ord, Ordering};
use std::collections::HashMap;
use std::fmt::Debug;
use std::vec::Vec;
struct HeapEntry<TKey, TPriority> {
key: TKey,
priority: TPriority,
}
@AngelicosPhosphoros
AngelicosPhosphoros / Source.cpp
Created October 8, 2020 17:47
Example of OVERLAPPED IO using WinAPI
#include <atomic>
#include <cassert>
#include <iostream>
#include <list>
#include <memory>
#include <mutex>
#include <optional>
#include <thread>
#include <vector>
@AngelicosPhosphoros
AngelicosPhosphoros / main.rs
Last active June 6, 2024 19:35
How to print enabled cpu target features in Rust
#![recursion_limit="512"]
// This script prints all cpu features which active in this build.
// There are 3 steps in usage of script:
// 1. get list of features using `rustc --print target-features`
// 2. put it into script (it has values actual for 2020-12-06 for x86-64 target).
// 3. run script.
fn pad_name(s: &str)->String{
let mut res = s.to_string();