Skip to content

Instantly share code, notes, and snippets.

View haxpor's full-sized avatar
🤓
Some of my financial tools https://www.mql5.com/en/users/haxpor/seller

Wasin Thonkaew haxpor

🤓
Some of my financial tools https://www.mql5.com/en/users/haxpor/seller
View GitHub Profile
@haxpor
haxpor / zhbuild
Last active April 27, 2022 11:29
A handy shell (bash) script to manage (build, export build setting, and deploy) Zombie Hero project
#!/bin/bash
## A simple shell script to build Zombie Hero Project from command line
## It involves using the following programs
##
## 1. xcodebuild
## 2. ios-deploy
##
## Commands support (*specific for this script and project)
##
@haxpor
haxpor / sysupdown
Created April 7, 2022 03:56
rc script to execute command(s) when system is up or down. Note the header lines which is required to have.
#!/bin/bash
### BEGIN INIT INFO
# Provides: <your service name>
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: execute commands when system is up or down
# Description: execute commands when system is up or down
@haxpor
haxpor / template_systemd.conf
Created April 6, 2022 18:10
Guideline and note on crafting out a minimal long running process via systemd config file (sweat and tears in the process)
[Unit]
Description=My systemd service
After=network.target
# allow cap of 4 attempts to start the process
# within 1 second, if not success, then give up
StartLimitIntervalSec=1
StartLimitBurst=4
[Service]
@haxpor
haxpor / SimpleDownloaders_future.cpp
Last active April 5, 2022 08:22
C++ studying of parallel + multithreading (c++11) following https://www.youtube.com/watch?v=_z-RS0rXg9s with some differences. Compile with "g++ -std=c++11 SimpleDownloader.cpp -lpthread -lcurl"
/** Downloader app following https://www.youtube.com/watch?v=_z-RS0rXg9s but
* use libcurl (C API) with some adjusted API usage.
*
* Compile with
* g++ -std=c++11 -DNO_PROXY SimpleDownloader.cpp -lpthread -lcurl
* */
#include <iostream>
#include <fstream>
#include <string>
@haxpor
haxpor / cargo_run_example.md
Last active March 17, 2022 13:17
Rust with cargo on how to run example in the rust project.

Run with cargo run --example <example-name>.

In Cargo.toml, configure it with the following if each example needs special crate's features.

[[example]]
name = "json"
required-features = ["json", "serde/derive"]
@haxpor
haxpor / liquidation.json
Created March 6, 2022 16:42
Processed with jq for json data returned from liquidation websocket of bybit - dev purpose
{
"topic": "liquidation.BTCUSD",
"data": {
"symbol": "BTCUSD",
"side": "Buy",
"price": "38931.50",
"qty": "50000",
"time": 1646584807379
}
}
@haxpor
haxpor / example.rs
Created March 2, 2022 18:50
Use .0 .1 and so on to access unnamed field from the specified arguments to one-line struct declaration
#[derive(Debug)]
struct Token(usize, usize);
fn main() {
let token = Token(1, 2);
println!("{} {}", token.0, token.1);
}
@haxpor
haxpor / singleline-list.txt
Created April 2, 2020 19:42
Full list in a single line of packages to be installed for AMDGPU-PRO driver for Linux via command `./amdgpu-pro-install --pro --opencl=legacy,pal`
amdgpu amdgpu-core amdgpu-dkms amdgpu-lib amdgpu-lib32 amdgpu-pro amdgpu-pro-core amdgpu-pro-lib32 clinfo-amdgpu-pro glamor-amdgpu gst-omx-amdgpu libdrm-amdgpu-amdgpu1 libdrm-amdgpu-amdgpu1:i386 libdrm-amdgpu-common libdrm2-amdgpu libdrm2-amdgpu:i386 libegl1-amdgpu-mesa libegl1-amdgpu-mesa:i386 libegl1-amdgpu-mesa-drivers libegl1-amdgpu-mesa-drivers:i386 libegl1-amdgpu-pro libegl1-amdgpu-pro:i386 libgbm1-amdgpu libgbm1-amdgpu:i386 libgl1-amdgpu-mesa-dri libgl1-amdgpu-mesa-dri:i386 libgl1-amdgpu-mesa-glx libgl1-amdgpu-mesa-glx:i386 libgl1-amdgpu-pro-appprofiles libgl1-amdgpu-pro-dri libgl1-amdgpu-pro-dri:i386 libgl1-amdgpu-pro-ext libgl1-amdgpu-pro-glx libgl1-amdgpu-pro-glx:i386 libglapi-amdgpu-mesa libglapi-amdgpu-mesa:i386 libglapi1-amdgpu-pro libglapi1-amdgpu-pro:i386 libgles1-amdgpu-mesa libgles1-amdgpu-mesa:i386 libgles2-amdgpu-mesa libgles2-amdgpu-mesa:i386 libgles2-amdgpu-pro libgles2-amdgpu-pro:i386 libllvm9.0-amdgpu libllvm9.0-amdgpu:i386 libomxil-bellagio-bin libomxil-bellagio0 libopencl1-amdgpu-pro
@haxpor
haxpor / make_clean.log
Created November 6, 2021 20:30
Compare the coverage of removal of files between `make clean` and `make distclean`. The latter has more coverage. Tested against my project https://github.com/haxpor/hashmap_c
$ make clean
rm -f test/tests
test -z "libhashmap_c.la" || rm -f libhashmap_c.la
rm -f ./so_locations
rm -rf .libs _libs
rm -rf externals/MurmurHash3/src/.libs externals/MurmurHash3/src/_libs
rm -rf src/.libs src/_libs
rm -rf test/.libs test/_libs
rm -f *.o
rm -f externals/MurmurHash3/src/*.o
@haxpor
haxpor / control
Last active November 6, 2021 12:28
Verbatim copy of content important configurations files for PPA package for libcurl4-openssl-dev. This is for research purpose.
Source: curl
Section: web
Priority: optional
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
XSBC-Original-Maintainer: Alessandro Ghedini <ghedo@debian.org>
Build-Depends: debhelper (>= 12),
autoconf,
automake,
ca-certificates,
dh-exec,