Skip to content

Instantly share code, notes, and snippets.

RisingWave Labs, Inc. Contributor License Agreement
Thank you for your interest in the open source project(s) managed by RisingWave Labs, Inc. (“RisingWave Labs”). In order to clarify the intellectual property license granted with Contributions from any person or entity, RisingWave Labs must have a Contributor License Agreement (“CLA”) on file that has been signed by each contributor, indicating agreement to the license terms below. This license is for your protection as a contributor as well as the protection of RisingWave Labs and its other contributors and users; it does not change your rights to use your own Contributions for any other purpose.
By clicking “Accept” on this page You accept and agree to these terms and conditions for Your present and future Contributions submitted to RisingWave Labs. In return, RisingWave Labs shall consider Your Contributions for addition to the official RisingWave Labs open source project(s) for which they were submitted. Except for the license granted herein to RisingW
[package]
name = "my_benchmark"
version = "0.1.0"
edition = "2021"
[dev-dependencies]
criterion = { version = "0.3", features = ["async_futures"]}
[[bench]]
name = "my_benchmark"
@TennyZhuang
TennyZhuang / utils.sh
Created November 9, 2020 08:59
Useful scripts
function fppc { fpp -c 'echo -n $F | pbcopy' }
@TennyZhuang
TennyZhuang / purestack.go
Last active July 15, 2020 07:54
A go function to create pure backtrace which can be used to aggregate traces.
package main
import (
"bytes"
"fmt"
"regexp"
"runtime/debug"
)
func f() {
import asyncio
import janus
import threading
loop = asyncio.get_event_loop()
q = janus.Queue(loop=loop)
class EventLoopThread(threading.Thread):
def run(self):
@TennyZhuang
TennyZhuang / property-v1.py
Last active September 18, 2017 05:35
Implement Python magic decorator
class PropertyDescriptor():
def __init__(self, getmethod):
self.getmethod = getmethod
def __get__(self, obj, cls=None):
return self.getmethod(obj)
def my_property(f):
return PropertyDescriptor(f)
@TennyZhuang
TennyZhuang / learnhelper.js
Created September 13, 2017 14:07
THU TA Learn Helper
const url = require('url');
const puppeteer = require('puppeteer');
const promisify = require('util').promisify;
const fs = require('fs');
const inquirer = require('inquirer');
const sleep = promisify(setTimeout);
const readFile = promisify(fs.readFile);
class TALearnHelper {
@TennyZhuang
TennyZhuang / index.js
Last active July 12, 2017 08:16
template code about homework 2
/*
You can feel free to modify the exsisting codes.
You should ensure all functions (or classes) will be submitted are in global
scope.
If you have any question, you can ask in our course wechat group.
*/
<html xmlns="http://www.w3.org/1999/xhtml"><!--<!DOCTYPE HTML>--><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="X-UA-Compatible" content="IE=5">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache">
<link type="text/css" href="styles/gbp/datepicker.css" rel="StyleSheet">
<script type="text/javascript" src="components/jquery/jquery-1.6.2.js"></script>
def fib_recursive_squaring(n):
def __multi(f1, g1, h1, f2, g2, h2):
return f1 * f2 + g1 * g2, f1 * g2 + g1 * h2, g1 * g2 + h1 * h2
def __fib(n):
if n == 1:
return 0, 1, 1
f, g, h = __fib(int(n / 2))
t1, t2, t3 = __multi(f, g, h, f, g, h)