Skip to content

Instantly share code, notes, and snippets.

View austin362667's full-sized avatar

Austin Liu austin362667

View GitHub Profile
package main
import (
"fmt"
"math"
"math/rand"
"reflect"
"time"
)

c6 jit arm64

  1. 首先利用 mmap allocate memory,回傳權限足夠的記憶體起點,如下:
char *memory = mmap(NULL,             // address
                      4096,             // size
                      PROT_READ | PROT_WRITE | PROT_EXEC,
                      MAP_PRIVATE | MAP_ANONYMOUS | MAP_JIT,
                      -1,               // fd (not used here)
                      0);               // offset (not used here)
@austin362667
austin362667 / ptivotshort-GMTUSDT.yaml
Last active June 2, 2022 13:29
ptivotshort-GMTUSDT.yaml
---
persistence:
redis:
host: 127.0.0.1
port: 6379
db: 0
sessions:
binance:
exchange: binance
@austin362667
austin362667 / pubsub.s1
Last active July 1, 2022 00:32
a tiny functional event emitter / pubsub.
// a tiny functional event emitter / pubsub.
fn Emitter(){
all := {'*':{}}
return {
// A Dynamic object/Map of event names to registered handler functions.
'all':all,
// Register an event handler for the given type.
'on':fn(type, handler){
(all[type])?push(all[type], handler):set(all, type, handler)
; source file: prog/hello.s1
; External declaration of the puts function
declare void @puts(i8* nocapture) nounwind
; Declare the string constant as a global constant.
@name = internal constant [8 x i8] c"script1\00"
; Definition of main function
define void @main(i32 %argc, i8** %argv) {
; Convert [13 x i8]* to i8 *... in local
@austin362667
austin362667 / SharkLong.go
Created September 28, 2022 04:32
Harmonic Pattern Strategy: Shark Long
func (s Harmonic) SharkLong(highs, lows *types.Queue, p float64) float64 {
score := 0.
for x := 5; x < 300; x++ {
X := lows.Index(x)
for a := 4; a < x; a++ {
if highs.Index(a-1) < highs.Index(a) && highs.Index(a) > highs.Index(a+1) {
A := highs.Index(a)
XA := math.Abs(X - A)
hB := A - 0.382*XA
lB := A - 0.618*XA
@austin362667
austin362667 / ReactivePredictor.go
Created October 1, 2022 01:33
ReactivePredictor predicts the case of a reactive user
func ReactivePredictor(memoryLength int, moves, wins types.Queue) float64 {
stateMachine := make(floats.Slice, int(math.Pow(2, 2.*float64(memoryLength)-1.)))
indMap := make(floats.Slice, 0)
for i := 2 * memoryLength; i >= 0; i-- {
indMap = append(indMap, math.Pow(2, float64(i)))
}
partOfMoves := moves.Array(moves.Length()-memoryLength, moves.Length()-1)
partOfWins := wins.Array(wins.Length()-memoryLength-1, wins.Length()-1)
lastState := append(partOfWins, partOfMoves...)
lastStateInd := 0.
@austin362667
austin362667 / kdbPlus_setup.md
Created October 11, 2022 03:20
install KDB+
  1. Download binary from link
    1. Submit personal information for getting Personal Edition
    2. Check mail box, download KX License(e.g., kc.lic)
  2. unzip m64.zip -d $HOME/q
  3. mv kc.lic $HOME/q/
    ├── kc.lic
    ├── m64
    │   └── q
    

└── q.k

@austin362667
austin362667 / pingtest.py
Last active October 14, 2022 05:48
binance server location
# requirements: pip install python-binance
# rest API
from time import time, sleep
from binance.client import Client
loop=10
KEY = 'your_key_here'
KEYSEC = 'your_secret_here'
total_delai = 0
bclient = Client(api_key=KEY,api_secret=KEYSEC)
for i in range(loop):