Skip to content

Instantly share code, notes, and snippets.

View wujunze's full-sized avatar
:octocat:
Learning

Panda wujunze

:octocat:
Learning
  • Open Source
  • Earth
  • 00:46 (UTC +08:00)
View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
@antirez
antirez / resp3.md
Last active June 2, 2020 08:41
RESP3 protocol draft

RESP3 specification

Versions history:

  • 1.0, 2 May 2018, Initial draft to get community feedbacks.

Background

The Redis protocol has served us well in the past years, showing that, if carefully designed, a simple human readable protocol is not the bottleneck in the client server communication, and that the simplicity of the design is a major advantage in creating a healthy client libraries ecosystem.

Yet the Redis experience has shown that after about six years from its introduction (when it replaced the initial Redis protocol), the current RESP protocol could be improved, especially in order to make client implementations simpler and to support new features.

@lifei6671
lifei6671 / snowflake.php
Created August 15, 2017 01:49
PHP实现的snowflake算法
/**
* 使用 snowflake 算法生成递增的分布式唯一ID.
* 该算法支持 15 条业务线,4 个数据中心,每个数据中心最多 128 台机器,每台机器每毫秒可生成 4096 个不重复ID.
*/
class Snowflake
{
const SEQUENCE_BITS = 12;
const MILLISECOND_BITS = 39;
const BUSINESS_ID_BITS = 4;
const DATA_CENTER_ID_BITS = 2;
@phith0n
phith0n / fpm.py
Last active April 16, 2024 13:04
Fastcgi PHP-FPM Client && Code Execution
import socket
import random
import argparse
import sys
from io import BytesIO
# Referrer: https://github.com/wuyunfeng/Python-FastCGI-Client
PY2 = True if sys.version_info.major == 2 else False
@cedricziel
cedricziel / migrate.sh
Created January 12, 2017 09:11
Very simple migration script to move from gitlab to gogs
#!/bin/env bash
## Needs `jq` (https://stedolan.github.io/jq/) on PATH
## and a personal gogs token of yours.
## Obtain token from https://git.example.com/user/settings/applications
## Usage:
## ./migrate.sh $clone_url $project_name [$optional_group]
## Migrate a repository to gogs into the user namespace of the token-user
## ./migrate.sh git@mygitlab.com:group/repo.git repo
## Migrate a repository to gogs into the group namespace `group` (needs to exist)
@tevino
tevino / epoll.go
Last active January 20, 2024 22:50
An example of using epoll in Go
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@saelo
saelo / decorator.go
Created March 8, 2015 19:45
Decorators in Go
package main
import (
"fmt"
"reflect"
)
func Decorate(impl interface{}) interface{} {
fn := reflect.ValueOf(impl)
@mattstauffer
mattstauffer / log.md
Last active June 14, 2023 09:23
Introduction to GistLog

So, you might be asking yourself, what is GistLog?

GistLog is a blogging "platform" for people who want to quickly write and publish content, in Markdown, and don't want to bother with yet another platform and yet another login and yet another group hoarding their content. With GistLog, you use your pre-existing GitHub login, you store the data in your own GitHub account, and you can publish with a single click.

Using GistLog

  1. Create a public gist with a single file using Markdown. Set the gist description to be the title of your blog post
  2. Copy the gist URL, and paste it into the text box on the GistLog create page
  3. Copy your resulting URL and share it as your blog post—note that it will be in the form of https://gistlog.co/your-github-username/gist-id
  4. If you want to have your own GistLog landing page (e.g. gistlog.co/mattstauffer), [read all about it](https://gistlog.co/mattstauffer/a82db5
@edokeh
edokeh / index.js
Last active April 18, 2024 08:07
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten