This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import stat | |
import sys | |
import urllib.request | |
import zipfile | |
from html.parser import HTMLParser | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! # A trie that can be saved to and loaded from a file | |
//! | |
//! This crate implements a Trie with char keys. | |
//! The trie can be saved to and loaded from a file on the local filesystem. | |
//! This allows the user to persist the trie between executions. | |
//! | |
//! Basic example: | |
//! | |
//! ```ignore | |
//! let trie_file = "/path/to/trie-file"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(getpid)] | |
use std::process::{self, Command, Output, Stdio}; | |
use std::result; | |
use std::io::{self, BufRead, Write}; | |
use std::num::ParseIntError; | |
use std::fs::File; | |
type Result<T> = result::Result<T, Box<io::Error>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.6 | |
import sys, os, signal, readline | |
signal.signal(signal.SIGINT, signal.default_int_handler) | |
P = {'pid': ['state', 'ppid', 'name'], os.getpid(): ['0', os.getppid(), sys.argv[0]]} | |
W = {'worm-ps': lambda _: [print(f"{k}\t{v[1]}\t{v[0]}\t{' '.join(v[2:])}") for k, v in P.items()], | |
'worm-kill': lambda a: os.kill(int(a[1]), int(a[2])) if len(a) == 3 else print('usage: worm-kill pid sig', file=sys.stderr), | |
'worm-history': lambda _: print('\n'.join([(readline.get_history_item(i)) for i in range(readline.get_current_history_length()) if readline.get_history_item(i)])), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from collections import Counter | |
import numpy | |
from PIL import Image | |
from webcolors import css3_hex_to_names, hex_to_rgb | |
from urllib.request import urlopen | |
import sys | |
import time | |
import matplotlib.pylab as plb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <algorithm> | |
#include <cctype> | |
#include <fstream> | |
#include <string> | |
#define PROC_STR "/proc/%s/stat" | |
pid_t | |
_getpppid(const char *, int); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
quadtree.py | |
A matrix implementation based on a pointer region quadtree, implemented in pure Python. | |
The script takes a scipy sparse matrix format as the only argument and calls 'eval' to use that format as the control matrix. | |
See: https://docs.scipy.org/doc/scipy/reference/sparse.html | |
Several sizes and densities are tested (all matrices are square). Measured: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bit_vec::BitVec; | |
use std::hash::{Hash, Hasher}; | |
// use 4 hash functions | |
use ahash::AHasher; | |
use fnv::FnvHasher; | |
use metrohash::MetroHash64; | |
use siphasher::sip::SipHasher; | |
pub struct BloomFilter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import scipy.fft | |
import cupyx | |
import cupy | |
# managed memory to stream large ndarrays to cuda | |
cupy.cuda.set_allocator(cupy.cuda.MemoryPool(cupy.cuda.memory.malloc_managed).malloc) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import numpy | |
import itertools | |
import soundfile | |
import sys | |
import multiprocessing | |
import argparse | |
sample_rate = 44100 |
OlderNewer