Skip to content

Instantly share code, notes, and snippets.

View williamlfang's full-sized avatar
🎯
Focusing

William Fang williamlfang

🎯
Focusing
View GitHub Profile
@williamlfang
williamlfang / cpucycles.cpp
Created April 8, 2020 16:55 — forked from ugovaretto/cpucycles.cpp
Get CPU clock cycles
//FROM STACKOVERFLOW: http://stackoverflow.com/questions/275004/c-timer-function-to-provide-time-in-nano-seconds
inline __int64 GetCpuClocks()
{
// Counter
struct { int32 low, high; } counter;
// Use RDTSC instruction to get clocks count
__asm push EAX
__asm push EDX
@williamlfang
williamlfang / ts.cpp
Created March 20, 2020 16:49 — forked from dtoma/ts.cpp
C++ timestamp with nanoseconds and timezone
#include <chrono>
#include <iomanip>
#include <iostream>
int main() {
auto now = std::chrono::high_resolution_clock::now();
auto time = std::chrono::system_clock::to_time_t(now);
auto tm = *std::gmtime(&time);
// auto tm = *std::localtime(&time);
Dependences:
sudo apt-get update
sudo apt-get install build-essential
apt-get install python-dev
sudo pip install -U setuptools
Steps:
download from https://mrjbq7.github.io/ta-lib/install.html
@williamlfang
williamlfang / python_blocks_for_repl.py
Created May 17, 2019 03:17 — forked from dantonnoriega/python_blocks_for_repl.py
Using SublimeREPL, this allows one to transfer AND evaluate blocks of python code. The code automatically detect python blocks, executes them, and skips white space, comment blocks (""") and comment lines (# ...).
"""
DESCRIPTION:
Using SublimeREPL, this plugin allows one to easily transfer AND
evaluate blocks of python code. The code automatically detect python
blocks and executes only code lines, omitting empty space and comments.
One can skips space, comment blocks and comment lines by executing on
empty lines, comments etc.
REQUIRES:
working with only 2 groups in the window. the main group (group 0)

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@williamlfang
williamlfang / post_install.sh
Created March 9, 2019 03:53 — forked from waleedahmad/post_install.sh
Ubuntu post installation script for installing software of your choice.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Lian subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="Stat" title="Stat">
<outline type="rss" text="Big Data, Plainly Spoken (aka Numbers Rule Your World)" title="Big Data, Plainly Spoken (aka Numbers Rule Your World)" xmlUrl="http://junkcharts.typepad.com/numbersruleyourworld/atom.xml" htmlUrl="http://junkcharts.typepad.com/numbersruleyourworld/"/>
<outline type="rss" text="The Numbers" title="The Numbers" xmlUrl="http://blogs.wsj.com/numbersguy/feed/" htmlUrl="https://blogs.wsj.com/numbers"/>
## =============================================================================
## myChinaFuturesCalendar.R
##
## 生成中国期货交易日
## 1. days :日盘时间
## 2. nights:夜盘时间
##
## =============================================================================
rm(list = ls())
setwd('/home/fl/myData')