Skip to content

Instantly share code, notes, and snippets.

View wayslog's full-sized avatar
🌙
我可以吞下玻璃而不变成玻璃

WaySLOG wayslog

🌙
我可以吞下玻璃而不变成玻璃
  • example.com
  • Shanghai, China
View GitHub Profile
@wayslog
wayslog / error.md
Created April 3, 2016 03:20
tikv compile error
/home/wayslog/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.48/src/regex.rs:3:5: 3:57 error: unresolved import `rustc::middle::const_eval::EvalHint::ExprTypeChecked`. Could not find `const_eval` in `rustc::middle` [E0432]
/home/wayslog/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.48/src/regex.rs:3 use rustc::middle::const_eval::EvalHint::ExprTypeChecked;
                                                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/wayslog/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.48/src/regex.rs:3:5: 3:57 help: run `rustc --explain E0432` to see a detailed explanation
/home/wayslog/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.48/src/regex.rs:4:33: 4:56 error: unresolved import `rustc::middle::const_eval::eval_const_expr_partial`. Could not find `const_eval` in `rustc::middle` [E0432]
/home/wayslog/.cargo/registry/src/github.com-88ac128001ac3a9a/clippy-0.0.48/src/regex.rs:4 
@wayslog
wayslog / my_spacemacs_conf.el
Created October 29, 2016 06:52
my spacemacs conf
dotspacemacs-configuration-layers
'(
;; lang
(python :variables python-enable-yapf-format-on-save t)
rust
(c-c++ :variables
c-c++-default-mode-for-headers 'c++-mode
c-c++-enable-clang-support t)
common-lisp
nim
use std::{ops, fmt};
#[derive(PartialEq, Debug)]
pub struct Matrix<T> {
data: Vec<T>,
row: usize,
col: usize,
}
impl<T: Copy> Matrix<T> {
from collections import namedtuple
class Parent(namedtuple("Parent",'name')):
def show(self):
print(self.name)
class Child(namedtuple("FirstChild", "sex"), Parent):
def show_sex(self):
import gevent.monkey
gevent.monkey.patch_all()
import time
from multiprocessing import Process
import gevent
import redis
from lanaya.invoker.bind import unwrap_bind
c = redis.StrictRedis()
def greenlet_func():
time.sleep(5)
use std::time::SystemTime;
fn main() {
let letters: String = (b'a'..b'z' + 1).map(|c| c as char).collect();
let repeated = letters.repeat(1000_0000);
let now = SystemTime::now();
let mut rslt: Vec<_> = (0..26).map(|_| 0).collect();
for ch in repeated.chars() {
let pos = ch as usize - 'a' as usize;
@wayslog
wayslog / main.rs
Created July 17, 2017 08:28
rust locker and context switch
#![feature(test)]
extern crate test;
#[bench]
fn test_lock(b: &mut test::Bencher) {
use std::sync::Mutex;
let locker = Mutex::new(1u32);
b.iter(|| {
for _ in 0..1000 {
#![feature(iterator_step_by)]
use std::time::SystemTime;
// 10! = 3_628_800
const TIMES: usize = 3_628_800 * 100;
fn lock_concurrency(worker: usize) {
use std::sync::{Mutex, Arc};
use std::thread;
@wayslog
wayslog / Lanaya Open API
Created December 4, 2017 06:10
lanaya open api v2
# Lanaya apiv2
## POST /api/v2/clusters
### json参数
| 参数名 | 参数类型 | 是否必须 | 备注 |
|--------------------|----------|----------|------------------------------------------------------|
pub struct BufferInterval<T, S, I>
where
T: Stream<Item = I>,
S: Store<Item = I>,
I: Clone,
{
interval: Interval,
rx: T,
store: S,
}