Skip to content

Instantly share code, notes, and snippets.

View beordle's full-sized avatar
💌
On vacation, oh..

Jindong Zhang beordle

💌
On vacation, oh..
  • Tencent
  • Beijing, China
View GitHub Profile
@beordle
beordle / blockchain.go
Created March 21, 2022 05:31 — forked from usbuild/blockchain.go
simple implementation of blockchain
package blockchain
import (
"time"
"crypto/sha256"
"encoding/binary"
"bytes"
"fmt"
)
@beordle
beordle / libuv_tls.c
Created February 18, 2022 12:13 — forked from ayende/libuv_tls.c
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <uv.h>
#define DEFAULT_PORT 7000
#define DEFAULT_BACKLOG 128
@beordle
beordle / sys_sum.go
Created January 11, 2022 03:12 — forked from ianlewis/sys_sum.go
Simple syscall in gVisor
// Copyright 2018 The gVisor Authors.
//
// Licensed 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
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@beordle
beordle / trace.c
Created December 2, 2021 07:36 — forked from MKo-xx/trace.c
trace.c
#include <stdio.h> // printf
#include <string.h> // strerror
#include <errno.h> // errno
#include <unistd.h> // execl
#include <sys/ptrace.h> // ptrace
#include <sys/user.h> // user_regs_struct
// get from strace sources
// cat strace-4.6/linux/x86_64/syscallent.h | sed -e 's/\(".*"\)/=\1/' | sed -e 's/^.*=//' | sed -e 's/"\(.*\)".*$/"\1",/'
//
@beordle
beordle / flatten.py
Last active August 29, 2015 14:12 — forked from andelf/flatten.py
flatten = lambda lst: reduce(lambda l,i: l + flatten(i) if isinstance(i, (list,tuple)) else l + [i], lst, [])
print flatten([2, [2, [4, 5, [7], [2, [6, 2, 6, [6], 4]], 6]]])
# -> [2, 2, 4, 5, 7, 2, 6, 2, 6, 6, 4, 6]
@beordle
beordle / 0_reuse_code.js
Created June 13, 2014 20:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console