Automatic Compilation in local Gitlab

1
2
3
4
5
6
7
8
9
#prerequisite, openssh-server
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo apt-get install gitlab-ce
 
#sudo vim /etc/gitlab/gitlab.rb
# change external_url to local ip.
 
sudo gitlab-ctl reconfigure
#sudo cat /etc/gitlab/initial_root_password

Open browser, visit http://localhost, login as 'root'.

Admin -> CI/CD -> Runners -> Register an instance runner, and get the registration token.

1
2
3
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
sudo apt-get install gitlab-runner
sudo gitlab-runner register

.gitlab-ci.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
stages:
  - deps
  - build
  - test
  - deploy

cache:
  paths:
    - include
    - lib
    - bin

build-deps:
  stage: deps
  script:
    - echo "will build include and lib to parent directory..."
    - cd 3rdParty; ./build_all.sh

build-job:
  stage: build
  script:
    - g++ helloworld.cpp -o bin/helloworld

unit-test-job:
  stage: test
  script:
    - chmod +x helloworld.sh
    - ./helloworld.sh

lint-test-job:
  stage: test
  script:
    - sleep 10

deploy-job:
  stage: deploy
  environment: production
  script:
    - ./pack.sh
  artifacts:
    paths:
      - bin.tgz
    expire_in: 4 days

refer to:
https://blog.csdn.net/weixin_47358139/article/details/126267861
https://blog.csdn.net/qq_42001163/article/details/122938040
https://blog.51cto.com/flyfish225/2145495
https://blog.csdn.net/zyy247796143/article/details/123842374

Automation memo

Terms,

HM: 回零模式
PVM: 带规划的速度模式
PPM: 带规划的位置模式
CSP: 循环同步的位置模式
CSV: 循环同步的速度模式
CST: 循环同步的转矩模式

refer to:
https://www.cnblogs.com/cariohu/p/15508175.html
https://zhuanlan.zhihu.com/p/406496635
https://blog.csdn.net/m0_51220742/article/details/122348389

NVSDK_NGX_D3D12_Init failed, error code: -1160773631

-1160773631 = 0xBAD00001,

C:\ProgramData\NVIDIA Corporation\NVIDIA NGX SDK\1.1\Include\nvsdk_ngx.h

NVSDK_NGX_API NVSDK_NGX_Result  NVSDK_CONV NVSDK_NGX_D3D12_Init(unsigned long long InApplicationId, const wchar_t *InApplicationDataPath, ID3D12Device *InDevice, NVSDK_NGX_Version InSDKVersion = NVSDK_NGX_Version_API);

C:\ProgramData\NVIDIA Corporation\NVIDIA NGX SDK\1.1\Include\nvsdk_ngx_defs.h

enum NVSDK_NGX_Result
{
    NVSDK_NGX_Result_Success = 0x1,

    NVSDK_NGX_Result_Fail = 0xBAD00000,

    // Feature is not supported on current hardware
    NVSDK_NGX_Result_FAIL_FeatureNotSupported = NVSDK_NGX_Result_Fail | 1,
...

So, old boys, RIP.

Install ClickHouse in Windows

After WSL is installed,

1
2
3
4
5
6
7
8
9
10
11
12
sudo apt-get install -y apt-transport-https ca-certificates dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754
 
echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee  /etc/apt/sources.list.d/clickhouse.list
 
 
sudo apt-get update
 
sudo apt-get install -y clickhouse-server clickhouse-client
 
sudo service clickhouse-server start
clickhouse-client # or "clickhouse-client --password" if you've set up a password.

After clickhouse-odbc is installed, create User SDN like

1
2
3
4
5
6
Name: ClickDb
Host: 192.168.1.123 // localhost outward ip
Port: 9004
Database: database_1 // created in clickhouse-client
User: default
Password: 123 // created during apt install clickhouse-server

Qt code for connecting clickhouse is

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlError>
#include <QMessageBox>
 
...
 
    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    db.setHostName("192.168.2.4");
    db.setPort(9004);             
    db.setDatabaseName("ClickDb");
    db.setUserName("default");
    db.setPassword("1");
    bool ok = db.open();
    if (ok) {
        QMessageBox::information(this, "infor", "Connected Ok.");
    }
    else {
        QMessageBox::information(this, "infor", "Connection failed.");
    }

CMakeLists.txt

1
2
find_package(Qt5 COMPONENTS Core ... Sql ...)
target_link_libraries(exe_1 Qt::Core ... Qt::Sql ...)

refer to:
https://blog.csdn.net/csgarten/article/details/127439859
https://www.jianshu.com/p/aeb1053f4e96
https://github.com/ClickHouse/clickhouse-odbc/releases
https://blog.csdn.net/weixin_46076132/article/details/123462457
https://www.codenong.com/cs106775070/

Run through dates in Python

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import datetime
 
def date_range(start_date, end_date):
	for n in range(int((end_date - start_date).days)):
		yield start_date + datetime.timedelta(n)
 
 
#start = datetime.datetime(2014, 11, 26, 0, 0, 0)
start = datetime.datetime.strptime("20230101", "%Y%m%d")
end = datetime.datetime.now()
 
for i in date_range(start, end):
	weekday = i.weekday() + 1
	if weekday == 6 or weekday == 7:
		continue
	print(i.strftime('%Y%m%d'))

refer to:
https://www.cnblogs.com/ChenKeng/articles/4141791.html
https://www.zkxjob.com/48467

Install Redis in WSL

1
2
3
4
5
6
7
8
9
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
sudo apt-get update
sudo apt-get install redis
 
# start server
redis-server
 
redis-cli
	config set requirepass 123123

Redis in python,

1
2
3
4
5
6
import redis
 
redis_pool = redis.ConnectionPool(host='127.0.0.1', port=6379, password='123123')
redis_conn = redis.Redis(connection_pool=redis_pool)
redis_conn.set('name_2', 'Zarten_2')
redis_conn.get('name_2')

refer to:
https://www.jianshu.com/p/ec8b749cd842
https://blog.csdn.net/weixin_30456039/article/details/97497620
https://blog.csdn.net/csdnhxs/article/details/122450575

Move Ubuntu subsystem elsewhere in Windows

After installing an Ubuntu app from Micosoft Store, open an Administrator's prompt,

1
2
3
4
5
6
7
8
9
10
wsl -l -v
wsl --export Ubuntu-22.04 d:\cext\Ubuntu\ubuntu22.04.tar
 
# or unistall it through System Settings
wsl --unregister Ubuntu-22.04
 
wsl --import Ubuntu d:\cext\Ubuntu\ubuntu22 d:\cext\Ubuntu\ubuntu22.04.tar
 
# start Ubuntu as eu
wsl -d Ubuntu -u eu

refer to:
https://blog.csdn.net/popboy29/article/details/126854886
https://blog.csdn.net/csdn_life18/article/details/128246494

世界经济年表

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
1760		蒸汽革命
1837-1842	经济危机
1856/7-1943/1		特斯拉
1857		经济危机
1861/4-1865/4	美国南北战争,废除奴隶制
1870		电气革命
1914/8-1918/11	一战
1929-1933	经济危机
1931/9		英国放弃金本位制
1933-1945/4		Franklin Delano Roosevelt 罗斯福 民主党
1939/9-1945/9	二战
1945/4-1953/1		Harry S.Truman 杜鲁门 民主党 
1950/6-1953/7	朝鲜战争
1953/1-1961/1		Dwight D.Eisenhower 艾森豪威尔 共和党
1955-1975	越南战争
1961/1-1963/11		John Fitzgerald Kennedy 肯尼迪 民主党
1963/11-1969/1		Lyndon Baines Johnson 约翰逊 民主党
1969/1-1974/8		Richard Milhous Nixon 尼克松 共和党
1974/8-1977/1		Gerald Rudolph Ford 福特 共和党
1977/1-1981/1		Jimmy Carter 卡特 民主党
1981/1-1989/1		Ronald Wilson Reagan 里根 共和党
1985		《广场协议》后日元大幅升值
1989/1-1993/1		George Herbert Walker Bush 老布什 共和党
1993/1-2001/1		William Jefferson Clinton 克林顿 民主党
2001/1-2009/1		George Walker Bush 小布什 共和党
2001/9/11
2001/10-2021/8	Afghanistan War
2003/3-2011/12	Iraq War
2006		subprime crisis 美国次贷危机
2009/1-2017/1		Barack Hussein Obama 奥巴马 民主党
2017/1-2021/1		Donald Trump 特朗普 共和党
20211-now		Joseph R. Biden Jr. 拜登 民主党

refer to:
https://baike.baidu.com/item/%E7%BE%8E%E5%9B%BD%E6%80%BB%E7%BB%9F/521627