Skip to content

Instantly share code, notes, and snippets.

View ytxmobile98's full-sized avatar

Tianxing Yang ytxmobile98

  • Guangzhou, China
  • 12:20 (UTC +08:00)
View GitHub Profile
@ytxmobile98
ytxmobile98 / vscode-install.sh
Last active October 23, 2023 06:29
VSCode install
#!/usr/bin/env bash
# Reference: https://code.visualstudio.com/docs/setup/linux
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install apt-transport-https
@ytxmobile98
ytxmobile98 / 2014-material-colors.txt
Created June 2, 2022 01:29
2014 material design colors
Red
50 #FFEBEE
100 #FFCDD2
200 #EF9A9A
300 #E57373
400 #EF5350
500 #F44336
600 #E53935
700 #D32F2F
800 #C62828
@ytxmobile98
ytxmobile98 / main.cpp
Created February 29, 2024 03:26
C++ member destructor
// Example program
#include <iostream>
#include <memory>
#include <string>
using std::cout;
using std::endl;
using std::make_unique;
using std::unique_ptr;
@ytxmobile98
ytxmobile98 / main.cpp
Created February 29, 2024 03:27
C++ pimpl example
// PIMPL
#include <iostream>
#include <string>
template <typename T>
class Pimpl {
protected:
T *const impl;
public:
Pimpl();
@ytxmobile98
ytxmobile98 / main.go
Last active July 10, 2024 00:24
Go use goroutines to print 1~10
package main
func printN(n int, prev <-chan struct{}, next chan<- struct{}) {
<-prev // wait for the previous signal
println(n)
next <- struct{}{} // activate the next goroutine
}
func printAll(n int) {
if n < 1 {
@ytxmobile98
ytxmobile98 / main.go
Created July 10, 2024 13:12
Multi-level map in Go
package main
var m = map[int]map[int]struct{}{
1: {2: struct{}{}},
}
func main() {
for _, item := range [][2]int{
{1, 2},
{1, 3},
@ytxmobile98
ytxmobile98 / Enable-NPU.md
Last active March 6, 2025 15:59
Install OpenVINO using APT on Ubuntu

Reference: https://github.com/intel/linux-npu-driver/releases/tag/v1.8.0

First we need to install the NPU drivers.

  • Ubuntu 24.04

    # 1. wget all the driver deb packages
    wget https://github.com/intel/linux-npu-driver/releases/download/v1.8.0/intel-driver-compiler-npu_1.8.0.20240916-10885588273_ubuntu24.04_amd64.deb
    wget https://github.com/intel/linux-npu-driver/releases/download/v1.8.0/intel-fw-npu_1.8.0.20240916-10885588273_ubuntu24.04_amd64.deb
@ytxmobile98
ytxmobile98 / main.go
Created December 18, 2024 05:51
1000 Goroutines
package main
import (
"fmt"
"runtime"
"sync"
"time"
)
func main() {
@ytxmobile98
ytxmobile98 / Half The Sky.md
Created March 27, 2025 01:46
Half The Sky Documentary