Skip to content

Instantly share code, notes, and snippets.

View GeneratePagination.cs
IEnumerable<int> GeneratePagination(int currentPage, int pageCount) {
var itemsAroundCurrent = 1;
var itemsAtEnds = 1;
var minimumSkip = 2;
var pagesOnScreen = (itemsAtEnds + minimumSkip + itemsAroundCurrent - 1) * 2 + 1;
if (pageCount <= pagesOnScreen) {
return Enumerable.Range(1, pagesOnScreen);
var skipEdge = itemsAtEnds + minimumSkip;
View base256.js
const BASE_START = "bghjklnpqrstvwyz";
const BASE_MID = "aeio";
const BASE_END = "cdfm";
const b256_encode = (source) => {
let buffer = '';
for (let byte of source) {
buffer += BASE_START[(byte >> 4)];
buffer += BASE_MID[((byte >> 2) & 0b11)];
fn swap_ranges_copy(vec: &mut [u8], offset1: usize, offset2: usize, len: usize) {
let tmp = vec.to_vec();
fn swap_ranges(vec: &mut [u8], mut offset1: usize, mut offset2: usize, mut len: usize) {
if offset1 < offset2 && offset1 + len >= offset2 {
// The ranges have the following layout here:
// [o1--------]
ZERO = (lambda hf: (lambda ax: ax))
TWENTY_SIX = lambda vf: lambda vx: \
INCREMENT = (lambda jnum: lambda jf: lambda jx: jf(jnum(jf)(jx)))
Z_COMBINATOR = (lambda gf:
((lambda gx: gf(lambda gy: gx(gx)(gy)))
(lambda gx: gf(lambda gy: gx(gx)(gy)))))
TRUE = (lambda bx: lambda by: bx)
macro_rules! field_offset {
($ty:path, $field:ident$(.$cfield:ident)*) => {
unsafe {
union Transmuter<T: 'static> {
p: *const T,
r: &'static T,
i: usize,
let base = Transmuter::<$ty> {
p: core::ptr::NonNull::dangling().as_ptr(),
View makefile
rustc -O -Clto=fat -Cpanic=abort --crate-type=staticlib --emit=obj -o shellcode.obj
cl.exe /Zi /nologo test.c shellcode.obj
/// Construct a circle from three tangent points.
/// Returns `None` if there is no unique solution. This happens when
/// the triangle formed by three points has zero area.
/// The algorithm goes as follows:
/// Construct two segment bisectors, defined parametrically:
/// Bisector for segment `ab`:
/// mid_ab + t * norm_ab = p, where t \in Real
View how-to-get.js
var page=1
var c = copy
fetch("", {"credentials":"include","headers":{"accept":"*/*","accept-language":"en-US,en;q=0.9,ru;q=0.8","content-type":"application/x-www-form-urlencoded; charset=UTF-8","csrf-token":"undefined","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin","x-requested-with":"XMLHttpRequest"},"referrer":"","referrerPolicy":"no-referrer-when-downgrade","body":`epmId=&language=en&location=us&tagPath=rmarketingproducts%3Aprocessors%2Fintelxeonprocessors&category=processors&currentPagePath=%2Fcontent%2Fwww%2Fus%2Fen%2Fproducts%2Fprocessors%2Fxeon%2Fview-all&Intel+Technology=All&Processor+Type=All&boundaryCache=3072%2C78848&Cache=3072%2C78848&boundaryClockSpeed=1100%2C4100&ClockSpeed=1100%2C4100&boundaryCoreCount=2%2C56&CoreCount=2%2C56&rangePrice=59.66%2C15749.99&price=59.66%2C15749.99&sortBy=release_date&acti
View translit.js
let map = {
"а": "a", "б": "b", "в": "v", "г": "h", "ґ": "g",
"д": "d", "е": "e", "є": "ie", "ж": "zh", "з": "z",
"и": "y", "і": "i", "ї": "i", "й": "i", "к": "k",
"л": "l", "м": "m", "н": "n", "о": "o", "п": "p",
"р": "r", "с": "s", "т": "t", "у": "u", "ф": "f",
"х": "kh", "ц": "ts", "ч": "ch", "ш": "sh", "щ": "shch",
"ю": "iu", "я": "ia",
"А": "A", "Б": "B", "В": "V", "Г": "H", "Ґ": "G",
"Д": "D", "Е": "E", "Є": "Ye", "Ж": "ZH", "З": "Z",
You can’t perform that action at this time.