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::borrow::Cow; | |
use regex::Regex; | |
lazy_static::lazy_static! { | |
static ref R1: Regex = Regex::new("(a)").unwrap(); | |
static ref R2: Regex = Regex::new("(b)").unwrap(); | |
static ref R3: Regex = Regex::new("(c)").unwrap(); | |
} |
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
pub struct SkipReader<R> { | |
inner: R, | |
skip: usize, | |
skipped: bool, | |
} | |
impl<R> SkipReader<R> { | |
pub fn new(reader: R, skip: usize) -> Self { | |
Self { | |
inner: reader, | |
skip, |
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::{ | |
marker::PhantomData, | |
ops::{Deref, DerefMut}, | |
}; | |
const EXTRA_MASK: u64 = 0xFFFF_0000_0000_0000; | |
const POINTER_MASK: u64 = 0x0000_FFFF_FFFF_FFFF; | |
pub struct Pointer<T> { | |
ptr: *mut (), | |
_marker: PhantomData<T>, |
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(test)] | |
extern crate test; | |
use rand::prelude::*; | |
use std::{io::Error, panic::catch_unwind}; | |
use test::Bencher; | |
fn main() {} | |
const TARGET: i32 = 30; |
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
#!/bin/bash | |
sudo apt update | |
sudo apt -y install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | |
sudo apt-get -y update | |
sudo apt-get -y install docker-ce |
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
fn close_test4() { | |
let string_postfix = "456"; | |
let closure = move |mut s: String| { | |
s.push_str(string_postfix); | |
s | |
}; | |
let mut vec_of_closures = Vec::new(); | |
// vec_of_closures.push(closure); | |
push_closure_to_vec(closure, &mut vec_of_closures); |
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
fn find_collatz(number: u64, cache: &mut Vec<i32>) -> i32 { | |
let n = cache.len() as u64; | |
let index = number as usize; | |
if number < n && cache[index] != 0 { | |
// cache hit | |
cache[index] | |
} else { | |
// cache miss | |
let result = match number { |
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 gzip as compressLib | |
import json | |
import hashlib | |
import asyncio | |
from pathlib import Path | |
import dataclasses | |
import requests | |
import aiohttp | |
import async_pool |
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
{ | |
"callback":"http://localhost:11913/weibo" | |
} |
NewerOlder