There are situations in which it might be useful to send a set of prefixes to other nodes in order to verify that they have the same set as we do (inter-group synchronization). When there are large number of prefixes, it will be beneficial to encode them in some way instead of just putting them in full in the message.
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 std::time::Instant; | |
fn number_to_index_mask(num: u32) -> (usize, u64) { | |
let num = (num - 1) / 2; | |
let index = (num / 64) as usize; | |
let bits = num % 64; | |
(index, 1 << bits) | |
} | |
fn unmark(mask: &mut [u64], num: u32) { |
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
// ==UserScript== | |
// @name TeXify the World MathJax | |
// @version 1.0 | |
// @description Enables MathJax to process LaTeX on all websites. Based off SOUP (Stack Overflow Unofficial Patch) and http://www.math.ucla.edu/~robjohn/math/mathjax.html. | |
// @include * | |
// ==/UserScript== | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; |
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
/// Consumes a generic array, splitting it at a given position. | |
pub fn split<M: ArrayLength<T>>(self) -> (GenericArray<T, M>, GenericArray<T, Diff<N, M>>) | |
where | |
N: Sub<M>, | |
Diff<N, M>: ArrayLength<T>, | |
{ | |
unsafe { | |
let array_ptr = &self as *const GenericArray<T, N>; | |
let ptr1 = mem::transmute::<_, *const GenericArray<T, M>>(array_ptr); | |
let tmp = mem::transmute::<_, *const T>(array_ptr); |
I hereby claim:
- I am fizyk20 on github.
- I am ebvalaim (https://keybase.io/ebvalaim) on keybase.
- I have a public key whose fingerprint is D7B6 BCC5 8A44 7959 3D23 B6AF 682F 8EEE E7E6 4B47
To claim this, I am signing this object:
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
from HTMLParser import HTMLParser | |
import requests | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
css_path = '/path/to/css' | |
class StyleReplacer(HTMLParser): |