Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Eagle 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
@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
@wudi
wudi / findauthors.sh
Last active May 22, 2019 — forked from stefanfoulis/findauthors.sh
How to sync svn to git
View findauthors.sh
#!/usr/bin/env bash
# Run this script inside a SVN checkout of the project
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
done
@wudi
wudi / es_expired_clean.sh
Last active Dec 26, 2018
clean elasticsearch expired data
View es_expired_clean.sh
#!/usr/bin/env bash
#Copyright (C) 2018 Eagle <eaglewudi@gmail.com>
ES_HOST="http://127.0.0.1:9200"
SEVEN_DAYS_AGO=$(date -d "-7 day" +%Y.%m.%d)
THREE_DAYS_AGO=$(date -d "-3 day" +%Y.%m.%d)
declare -a INDEX_FOR_SEVEN=(
"filebeat-xxx-"
View arch_enable_bbr.sh
#!/bin/bash
#
# A script to enable TCP BBR on a Linux system.
#
# @author Dumitru Uzun (DUzun.Me)
# @version 1.0.0
# @distro ArchLinux/Manjaro
#
old_cc=`sysctl net.ipv4.tcp_congestion_control | awk -F= '{print $2}' | sed -e s/\^\\s//`
@wudi
wudi / closure_in_extension.c
Created Aug 14, 2018
closure in extension include USE
View closure_in_extension.c
/* laravel extension for PHP */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "php.h"
#include "ext/standard/info.h"
#include "php_laravel.h"
View closure.c
static void git_ex_cb(INTERNAL_FUNCTION_PARAMETERS)
{
zval *payload, *this = getThis();
char *oid;
int oid_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
"sz", &oid, &oid_len, &payload) == FAILURE) {
return;
}
You can’t perform that action at this time.