Skip to content

Instantly share code, notes, and snippets.

View liuchang0812's full-sized avatar

Chang Liu liuchang0812

  • Wechat
  • Shenzhen
View GitHub Profile
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
@liuchang0812
liuchang0812 / election.go
Last active November 18, 2019 09:06
etcd clientv3 election
const prefix = "/resume-election/"
cli, _ := clientv3.New(clientv3.Config{Endpoints: endpoints})
defer cli.Close()
var s *concurrency.Session
s, _ = concurrency.NewSession(cli)
defer s.Close()
e := concurrency.NewElection(s, prefix)
FROM ubuntu:14.04
MAINTAINER liuchang0812@gmail.com
ADD crontab /etc/cron.d/hello-cron
RUN chmod 0644 /etc/cron.d/hello-cron
RUN touch /var/log/cron.log
RUN /usr/bin/crontab /etc/cron.d/hello-cron
CMD tail -f /var/log/cron.log
➜ example git:(master) ✗ cat ex-1.cpp
#include "core/app-template.hh"
#include "core/reactor.hh"
#include <iostream>
int main(int argc, char** argv) {
seastar::app_template app;
app.run(argc, argv, [] {
std::cout << "Hello world\n";
std::cout << seastar::smp::count << "\n";
@liuchang0812
liuchang0812 / librados3
Created December 11, 2017 04:10
librados3
in memory of closed/reverted PRs
- pass "bufferlist&&" to setxattr(): https://github.com/ceph/ceph/pull/12206
- bump up the so version of librados: https://github.com/ceph/ceph/pull/11843
- unify the list::const_iterator and list::iterator https://github.com/ceph/ceph/pull/6215
- pass size_t and ssize_t to advance() and seek() https://github.com/ceph/ceph/pull/11993
- kill ack/commit distinction and replace with a single completion callback/state.
@liuchang0812
liuchang0812 / coroutines.json
Last active November 20, 2017 14:13
RGW S3-export
{
"coroutine_managers": [{
"run_contexts": []
}, {
"run_contexts": [{
"id": 1,
"entries": [{
"stack": "0x56256b275de0",
"run_count": 0,
"ops": [{
@liuchang0812
liuchang0812 / s3restconn.diff
Created November 16, 2017 08:23
S3RESTConn Patch
diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc
index 7fdf5ff..3c86d05 100644
--- a/src/rgw/rgw_rest_conn.cc
+++ b/src/rgw/rgw_rest_conn.cc
@@ -81,7 +81,7 @@ string RGWRESTConn::get_url()
return endpoint;
}
-static void populate_params(param_vec_t& params, const rgw_user *uid, const string& zonegroup)
+void RGWRESTConn::populate_params(param_vec_t& params, const rgw_user *uid, const string& zonegroup)
@liuchang0812
liuchang0812 / clean.py
Last active March 20, 2017 08:18
清理脚本
# -*- coding: utf-8 -*-
from qcloud_cos import ListFolderRequest, DelFileRequest, CosClient
def to_unicode(s):
if isinstance(s, str):
return s.decode('utf-8')
else:
return s
@liuchang0812
liuchang0812 / asdfsf.rst
Last active February 28, 2017 13:22
asfsdfa
#.
A one, two, a one two three four

Half a bee, philosophically,
    must, ipso facto, half not be.
But half the bee has got to be,
    *vis a vis* its entity. D'you see?

But can a bee be said to be
    or not to be an entire bee,
#include <iostream>
using namespace std;
class Base
{
public:
int Jiao()
{
return JiaoImpl();
}