This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <assert.h> | |
#include <signal.h> | |
#define BYTE sizeof(int8_t) | |
#define KILOBYTE 1024*BYTE | |
#define MEGABYTE 1024*KILOBYTE | |
#define GIGABYTE 1024*MEGABYTE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
while read line;do | |
echo $line | |
cd $line | |
repo_name=$(git remote -v |grep -E '.*https://aur.tuna.tsinghua.edu.cn/.*' |awk '{print $2}' |head -n1 |awk -v FS='/' '{print $4}') | |
if [[ "$repo_name" != "" ]];then | |
git remote set-url origin https://aur.archlinux.org/$repo_name | |
#git remote -v |head -n1 | |
#echo https://aur.archlinux.org/$repo_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
import numpy as np | |
import math | |
def Hamiltonian3(k): | |
# 元胞内的两个C原子坐标 | |
pos1 = np.array([0, 0]) | |
pos2 = np.array([0, 1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
cat $1 |\ | |
jq '.cells|.[] |select(.cell_type == "code") | .source|.[]' |\ | |
sed -n 's/"\(.*\)\\n"/\1/p' |\ | |
sed 's/\\"/"/g' > $1.py | |
# jq select code cell | |
# sed 1. remove the prefix " and suffix \n" | |
# 2. " in code will save as \" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################################### | |
# the _ after password filed will cause error, change it with 6, after decode there will be a '/' in the string, so | |
# if without the last '=' invalid. `echo -n "$str"| base64 -d |base64` give me an extra '=', so added | |
# /_/6/: after password fieled | |
# /\///: after password field | |
# /-/+/: remark 韩国 | |
#string1=$(tail -n1 ss |sed 's/_/6/g' |sed 's/$/=/' |base64 -d |sed 's/\///'| sed 's/-/+/g') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 最后生成的目标,即module_example.ko | |
obj-m:=module_example.o | |
CURRENT_PATH := $(shell pwd) | |
LINUX_KERNEL := $(shell uname -r) | |
LINUX_KERNEL_PATH := /usr/lib/modules/$(LINUX_KERNEL)/build | |
all: | |
make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) modules | |
clean: | |
make -C $(LINUX_KERNEL_PATH) M=$(CURRENT_PATH) clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
var="$*" | |
lsof -i|awk -v pattern="$var" ' | |
NR==1 {print $0}; | |
NR>=1 && $0 ~ pattern {print $0}' |