Skip to content

Instantly share code, notes, and snippets.

View bsdelf's full-sized avatar

bsdelf bsdelf

  • Shanghai
View GitHub Profile
#include <iostream>
#include <string>
#include <deque>
#include <array>
using namespace std;
struct Frame
{
int p;
int id;
@bsdelf
bsdelf / main.cc
Created March 13, 2014 12:32
critical vertices
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
using namespace std;
template <typename T, typename V>
T& operator<<(T& t, V v)
{
t.push_back(v);
@bsdelf
bsdelf / gist:9581226
Created March 16, 2014 10:23
parse & statistical
import argparse
import re
import copy
from collections import defaultdict
"""
format:
*********************** PAPER 1 ***********************
+++++++++++++++++ REVIEW 1 ++++++++++++++++
@bsdelf
bsdelf / eigenface.py
Created March 25, 2014 05:59
eigenface
import argparse
import numpy as np
from scipy import linalg
def ReadTillWhite(fd):
data = b''
while True:
ch = fd.read(1)
if ch in b"\r\t\n ":
break
@bsdelf
bsdelf / main.cc
Created August 17, 2014 13:38
remove watermark for "pdf.th7.cn/down/files/1407/Real%20World%20OCaml.pdf"
/*
* clang++ -I/usr/local/include -pipe -std=c++11 -stdlib=libc++ -o main.cc.o -c main.cc
* clang++ -L/usr/local/lib -lpodofo -stdlib=libc++ -o b.out main.cc.o
*
*/
#include <iostream>
#include <string>
#include <list>
using namespace std;
@bsdelf
bsdelf / EasyJumpPreciseMotionAce.vim
Created November 14, 2017 07:32 — forked from gfixler/EasyJumpPreciseMotionAce.vim
A Vim take on Emacs' AceJump mode, itself based on Vim's PreciseJump and EasyMotion plugins
" ACEJUMP
" Based on emacs' AceJump feature (http://www.emacswiki.org/emacs/AceJump).
" AceJump based on these Vim plugins:
" EasyMotion (http://www.vim.org/scripts/script.php?script_id=3526)
" PreciseJump (http://www.vim.org/scripts/script.php?script_id=3437)
" Type AJ mapping, followed by a lower or uppercase letter.
" All words on the screen starting with that letter will have
" their first letters replaced with a sequential character.
" Type this character to jump to that word.
package main
import (
"os"
"fmt"
"net/http"
"github.com/gin-gonic/gin"
"github.com/kataras/iris"
"github.com/astaxie/beego"
@bsdelf
bsdelf / utf8.js
Created August 26, 2019 09:55
detect utf8 in pure js
// Reference:
// https://stackoverflow.com/questions/1031645/how-to-detect-utf-8-in-plain-c
export const isUtf8 = (data) => {
if (data.length <= 0) {
return false;
}
for (let i = 0; i < data.length; ) {
const a = data[i];
if ([0x09, 0x0a, 0x0d].includes(a) || (0x20 <= a && a <= 0x7e)) {
cita git:(develop) ? % make release
RUSTFLAGS='-F warnings' cargo build -j 1 --all --release
Compiling create-genesis v0.1.0 (/tmp/cita/tools/create-genesis)
Compiling librocksdb-sys v6.1.2
error[E0277]: arrays only have std trait implementations for lengths 0..=32
--> /tmp/cita/target/release/build/librocksdb-sys-9f0f3e945a905dbc/out/bindings.rs:3:8392
|
3 | pub const __GNUC_VA_LIST : u32 = 1 ; pub const __WORDSIZE : u32 = 64 ; pub const __DARWIN_ONLY_64_BIT_INO_T : u32 = 0 ; pub const __DARWIN_ONLY_VERS_1050 : u32 = 0 ; pub const __DARWIN_ONLY_UNIX_CONFORMANCE : u32 = 1 ; pub const __DARWIN_UNIX03 : u32 = 1 ; pub const __DARWIN_64_BIT_INO_T : u32 = 1 ; pub const __DARWIN_VERS_1050 : u32 = 1 ; pub const __DARWIN_NON_CANCELABLE : u32 = 0 ; pub const __DARWIN_SUF_64_BIT_INO_T : & 'static [ u8 ; 9usize ] = b"$INODE64\0" ; pub const __DARWIN_SUF_1050 : & 'static [ u8 ; 6usize ] = b"$1050\0" ; pub const __DARWIN_SUF_EXTSN : & 'static [ u8 ; 14usize ] = b"$DARWIN_EXTSN\0" ; pub const __DARWIN_C_ANSI : u3
@bsdelf
bsdelf / binary_trees.cc
Last active December 4, 2019 03:16
benchmarks game - binary trees
#include <inttypes.h>
#include <condition_variable>
#include <deque>
#include <iostream>
#include <memory>
#include <mutex>
#include <thread>
#include <variant>
#include <vector>