Skip to content

Instantly share code, notes, and snippets.

🎧
Focusing

Di Wu wudi

🎧
Focusing
Block or report user

Report or block wudi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Good-CONTRIBUTING.md-template.md

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@wudi
wudi / functional-options.go
Last active Dec 7, 2019
Functional Options
View functional-options.go
package main
type Option func(*Options)
type Options struct {
Context context.Context
Addrs []string
Timeout time.Duration
}
View gist:160b3a03bfd3127eab21d296c054c5fb
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
@wudi
wudi / LICENCE SUBLIME TEXT
Created Oct 29, 2019
Sublime Text 3 Serial key build is 3176
View LICENCE SUBLIME TEXT
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
View balance_udp_packet_dispath.patch
diff --git a/src/network/ReactorThread.c b/src/network/ReactorThread.c
index e3aac4f5..a9617ff3 100644
--- a/src/network/ReactorThread.c
+++ b/src/network/ReactorThread.c
@@ -197,14 +197,14 @@ static int swReactorThread_onPackage(swReactor *reactor, swEvent *event)
{
pkt.port = ntohs(info.addr.inet_v4.sin_port);
pkt.addr.v4.s_addr = info.addr.inet_v4.sin_addr.s_addr;
- task.data.info.fd = pkt.addr.v4.s_addr;
+ task.data.info.fd = pkt.port;
@wudi
wudi / aes_enc_dec.php
Created Jul 11, 2019 — forked from turret-io/aes_enc_dec.php
AES encryption/decryption in PHP
View aes_enc_dec.php
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@wudi
wudi / curl-websocket.sh
Last active May 23, 2019 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
View curl-websocket.sh
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@wudi
wudi / swoole_issues.md
Last active May 8, 2019
Swoole Issues
View swoole_issues.md
View gist:8fbf2f067974c2d67251be5bff4c76d2
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
      • Centralized locking can be based on this K/V store.
View Price-Time Matching Engine.c
/*****************************************************************************
* QuantCup 1: Price-Time Matching Engine
*
* Submitted by: voyager
*
* Design Overview:
* In this implementation, the limit order book is represented using
* a flat linear array (pricePoints), indexed by the numeric price value.
* Each entry in this array corresponds to a specific price point and holds
* an instance of struct pricePoint. This data structure maintains a list
You can’t perform that action at this time.