Skip to content

Instantly share code, notes, and snippets.

View jahentao's full-sized avatar

Jiaheng Tao jahentao

  • HangZhou, Zhejiang
View GitHub Profile
@jahentao
jahentao / dbg_1.sh
Created April 13, 2023 03:01
调试hpf_dt正确性验证
grep -F "peer->que" hpf_dt.log | awk '{print $(NF-2) $NF}' | sort -r |uniq
@jahentao
jahentao / TreeNode.java
Created December 26, 2021 03:07
水平和竖直打印二叉树
/**
* https://leetcode-cn.com/playground/VDCGQ8Ds/
*
* Definition for a binary tree node.
*/
public class TreeNode {
public int val;
public TreeNode left;
@jahentao
jahentao / tmux-cheatsheet.markdown
Created May 29, 2021 01:23 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@jahentao
jahentao / 导出visio中图片为svg格式.vbs
Created May 2, 2020 05:17
导出visio中图片为svg格式(VB脚本)
Public Sub ExportPages()
'Declare object variables as Visio object types.
Dim vsoPage As Visio.Page
Dim vsoDocument As Visio.Document
Dim vsoDocuments As Visio.Documents
Dim vsoPages As Visio.Pages
'Iterate through all open documents.
Set vsoDocuments = Application.Documents
@jahentao
jahentao / Worksheet_Change.cls
Created April 28, 2020 09:05
Excel数据校验下拉框选择多个项(模板,仅需改列)
Private Sub Worksheet_Change(ByVal Target As Range)
' Developed by Contextures Inc.
' www.contextures.com
Dim rngDV As Range
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
@jahentao
jahentao / WSL-ssh-server.md
Created April 28, 2020 01:34 — forked from dentechy/WSL-ssh-server.md
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
    2. Change PasswordAuthentication to yes. This can be changed back to no if ssh keys are setup.
  2. Restart the ssh server:
    • sudo service ssh --full-restart
  3. With this setup, the ssh server must be turned on every time you run Bash on Ubuntu on Windows, as by default it is off. Use this command to turn it on:
export LS_COLORS='no=00:fi=00:di=34:ow=34;40:ln=35:pi=30;44:so=35;44:do=35;44:bd=33;44:cd=37;44:or=05;37;41:mi=05;37;41:ex=01;31:*.cmd=01;31:*.exe=01;31:*.com=01;31:*.bat=01;31:*.reg=01;31:*.app=01;31:*.txt=32:*.org=32:*.md=32:*.mkd=32:*.h=32:*.c=32:*.C=32:*.cc=32:*.cpp=32:*.cxx=32:*.objc=32:*.sh=32:*.csh=32:*.zsh=32:*.el=32:*.vim=32:*.java=32:*.pl=32:*.pm=32:*.py=32:*.rb=32:*.hs=32:*.php=32:*.htm=32:*.html=32:*.shtml=32:*.erb=32:*.haml=32:*.xml=32:*.rdf=32:*.css=32:*.sass=32:*.scss=32:*.less=32:*.js=32:*.coffee=32:*.man=32:*.0=32:*.1=32:*.2=32:*.3=32:*.4=32:*.5=32:*.6=32:*.7=32:*.8=32:*.9=32:*.l=32:*.n=32:*.p=32:*.pod=32:*.tex=32:*.go=32:*.bmp=33:*.cgm=33:*.dl=33:*.dvi=33:*.emf=33:*.eps=33:*.gif=33:*.jpeg=33:*.jpg=33:*.JPG=33:*.mng=33:*.pbm=33:*.pcx=33:*.pdf=33:*.pgm=33:*.png=33:*.PNG=33:*.ppm=33:*.pps=33:*.ppsx=33:*.ps=33:*.svg=33:*.svgz=33:*.tga=33:*.tif=33:*.tiff=33:*.xbm=33:*.xcf=33:*.xpm=33:*.xwd=33:*.xwd=33:*.yuv=33:*.aac=33:*.au=33:*.flac=33:*.m4a=33:*.mid=33:*.midi=33:*.mka=33:*.mp3=33:*.mpa=33:*.mpe
@jahentao
jahentao / shadowsockr.service
Created April 20, 2019 02:24
systemd脚本,适用于CentOS/RHEL7以上,Ubuntu 15以上,Debian8以上
[Unit]
Description=ShadowsocksR client
After=network.target
Wants=network.target
[Service]
Type=forking
PIDFile=/var/run/shadowsocksr.pid
ExecStart=/usr/bin/python /opt/shadowsocksr/shadowsocks/local.py -c /etc/shadowsocks.json -d start
ExecStop=/usr/bin/python /opt/shadowsocksr/shadowsocks/local.py -c /etc/shadowsocks.json -d stop
@jahentao
jahentao / do_login.sh
Last active April 10, 2019 09:06
浙江大学(宁波校区)软件学院_上网验证 #Util
# 采用curl命令行方式
# 我的用户名 21851075,密码 123456ABC
username=21851075
password=123456ABC
pass1=$(echo -n $password | md5sum |cut -d ' ' -f1)
pass2=$(echo ${pass1:8:16})
curl -H "Content-Type: application/x-www-form-urlencoded" \
-b srun_login=$username%7C$password \
-A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36" \
-d "username=$username&password=$pass2&drop=0&type=1&n=100" \
@jahentao
jahentao / judge_variable_type_in_go.go
Created March 24, 2019 13:15
Go语言语法片段
// 判断go语言中变量的类型
package main
import (
"fmt"
)
var container = []string{"zero", "one", "two"}
func main() {