Skip to content

Instantly share code, notes, and snippets.

View ricky9w's full-sized avatar
🏠
Working from home

Richard Wang ricky9w

🏠
Working from home
View GitHub Profile
## powerlevel10k and znap
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
[[ -r ~/.config/zsh/znap/znap.zsh ]] ||
git clone --depth 1 -- \
https://github.com/marlonrichert/zsh-snap.git ~/.config/zsh/znap
- name: Campus
interface-name: wg0
type: select
proxies:
- DIRECT
---
version: '3'
services:
trojan-go:
image: teddysun/trojan-go:latest
restart: always
volumes:
- ./server.json:/etc/trojan-go/server.json
- ./crt/:/opt/crt/
command: /usr/bin/trojan-go -config /etc/trojan-go/server.json
@ricky9w
ricky9w / kernel.log
Created November 18, 2022 02:28
Openwrt 网卡断流系统和内核日志
[193902.436087] netifd[1935]: segfault at 7fdc67b48098 ip 000000000041bbd6 sp 00007ffc3dc65900 error 4 in netifd[404000+1b000]
[193902.437573] Code: 01 75 31 48 8b 53 58 be fe 3b 42 00 bf 02 00 00 00 31 c0 e8 01 e6 ff ff 48 89 df e8 23 f0 ff ff c7 83 90 00 00 00 00 00 00 00 8b 7b 68 5b e9 f1 cf ff ff 5b c3 53 48 8d 9f 48 ff ff ff 83 fa
[193907.509469] br-lan: port 2(eth2) entered disabled state
[193907.510528] br-lan: port 1(eth0) entered disabled state
[193907.515712] device eth3 left promiscuous mode
[193907.516764] br-lan: port 3(eth3) entered disabled state
[193907.536369] device eth2 left promiscuous mode
[193907.537567] br-lan: port 2(eth2) entered disabled state
[193907.557992] device eth0 left promiscuous mode
[193907.559029] br-lan: port 1(eth0) entered disabled state
@ricky9w
ricky9w / README.md
Last active November 15, 2022 14:45
Bash script for a comprehensive stress testing on CPU, memory, system I/O and disk

Comprehensive Stress Testing

Comprehensive stress testing on CPU, memory, system I/O and disk

Dependencies

  • stress
  • jq
  • lm-sensors
import os
import pandas as pd
lower_bound = int(input("Please enter the lower bound: "))
upper_bound = int(input("Please enter the upper bound: "))
file_list = []
for file_name in os.listdir("."):
if file_name.endswith(".csv"):
file_list.append(file_name)
@ricky9w
ricky9w / intro-to-software-building.org
Created April 14, 2022 17:52
Basic concepts of software building tools, introduction to Make and CMake

Introduction to Software Building

Introduction

Make, Ninja, Ant, Gradle, MSVC are some of the build systems. They help us to drive the compiler and other build tools. You may need to write a ‘build file’ to tell them the dependency information for them to build a software.

While this is already very convenient, the building of C/C++ projects is not standard across the platforms. Then you may need a ‘meta-build system’ to help you generate ‘build’ files for different build systems.

CMake is such a ‘meta-build system’ that can generate platform based system files by setting some flags.

See this article about the details of a buildsystem: What Is a Build System? - Scott Dorman

@ricky9w
ricky9w / new-app-instance-macos.org
Created March 20, 2022 09:02
Create a new instance of certain app with spotlight instead of jumping to the already running one.

Open New Instance of Applicatiosn With Automator

It’s annoying on macOS that, if you have an app running in one desktop, and try to open another instance in a separate desktop by clicking on it or spotlight, the OS will jump to the original one, instead of opening a new instance.

This can be solved by Automator app. You can do some pre-build actions or run scripts with it, and Actions created with Automator can be indexed by spotlight.

Open New Instance of Applications

You can open new instances of applications either with shell command or applescript.

  • With shell command Run open -na <app> to open a new instance of app. Note that this may mess up your dock since it will likely create separate icons for each instance. Refer to the manual (man open) for more info.
@ricky9w
ricky9w / alternative.yaml
Created January 24, 2022 10:26
Use half-shape punctuator in Rime
# Rime alternative settings
# encoding: utf-8
#
# description:
#
# difference from default settings:
# 1. ascii-style punctuation in half-shape mode
# 2. [ ] as paging keys
#
# save this file as:
@ricky9w
ricky9w / teaching-applysquare.js
Created December 23, 2021 12:46
Enable download for attachments on teaching.applysquare.com
// ==UserScript==
// @name 教学立方课件下载脚本
// @namespace http://tampermonkey.net/
// @version 0.6
// @description 在课件页点击导航栏"显示下载链接", 无论课件是否开放下载权限. 仅作学习研究之用, 敬请尊重版权!
// @author Richard
// @match https://teaching.applysquare.com/S/Course/index/cid/*
// @grant none
// ==/UserScript==