Skip to content

Instantly share code, notes, and snippets.

View zthxxx's full-sized avatar
🐾
Nyaa~

zthxxx zthxxx

🐾
Nyaa~
View GitHub Profile
@zthxxx
zthxxx / deb-install-nvidia-docker.sh
Last active May 8, 2018 13:21
install nvidia-docker on Debian/Ubuntu, and run tensorflow
# If you have nvidia-docker 1.0 installed: we need to remove it and all existing GPU containers
docker volume ls -q -f driver=nvidia-docker | xargs -r -I{} -n1 docker ps -q -a -f volume={} | xargs -r docker rm -f
apt purge -y nvidia-docker
# Add the package repositories
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
tee /etc/apt/sources.list.d/nvidia-docker.list
apt update
@zthxxx
zthxxx / init-swap.sh
Created May 13, 2018 18:56
create a swap space on ubuntu
# https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04
fallocate -l ${SWAP_SIZE:-8G} /swapfile
chmod 600 /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
@zthxxx
zthxxx / install-lrzsz.sh
Last active July 7, 2022 09:21
install-lrzsz on macOS
#!/usr/bin/env zsh
brew install lrzsz
recv='/usr/local/bin/iterm2-recv-zmodem.sh'
send='/usr/local/bin/iterm2-send-zmodem.sh'
curl -sSL https://github.com/RobberPhex/iTerm2-zmodem/raw/master/iterm2-recv-zmodem.sh -o "$recv"
curl -sSL https://github.com/RobberPhex/iTerm2-zmodem/raw/master/iterm2-send-zmodem.sh -o "$send"
chmod +x "$recv" "$send"
@zthxxx
zthxxx / .screenrc
Last active November 8, 2023 16:02
screen preference
# Install
# curl -sL https://gist.github.com/zthxxx/df7e121048b12c80f260285d88e1091f/raw/.screenrc -o ~/.screenrc
# curl -s https://gist.githubusercontent.com/zthxxx/df7e121048b12c80f260285d88e1091f/raw/.screenrc -o ~/.screenrc
# Shortcut Key binding
# https://www.gnu.org/software/screen/manual/screen.html#Bindkey
# remap prefix key `Ctrl-A` to `Ctrl-S`
@zthxxx
zthxxx / word 论文插入打断符宏.vba
Created September 2, 2018 17:42
word 论文中插入打断符,用于打断查重系统读取句子或词语的重复率判断
Sub 插入打断符()
'
' 插入打断符 宏
' 每间隔 ds 个字符插入一个打断符,用于打断查重系统读取句子或词语的重复率判断
' 需要导入一个叫 “打断符” 的样式
' 字体样式继承 正文
' 字体后续样式 正文
' 字体大小 1px
' 字体颜色 白色
' 字体宽度 0%
@zthxxx
zthxxx / get-wifi-ssid.sh
Created October 18, 2018 05:11
get WiFi SSID name on MacOS terminal
ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/local/bin/airport
airport -I | awk -F': ' '/ SSID/ {print $2}'
@zthxxx
zthxxx / D3js5.9-Threejs102-WebGL-force-directed-graph.html
Last active March 4, 2019 08:07
D3js5.9-Threejs102-WebGL-force-directed-graph Demo
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#root,
body,
html {
width: 100%;
height: 100%;
@zthxxx
zthxxx / jenkins-lastbuild-log.js
Last active April 11, 2019 08:00
jenkins last build log to markdown table
const fs = require('fs');
const os = require('os');
const path = require('path');
const exec = require('child_process').exec;
const axios = require('axios')
const dayjs = require('dayjs')
const getJobInfo = async job => {
@zthxxx
zthxxx / github-stars-and-contributions.js
Last active June 25, 2019 08:29
count a GitHub user's stars and contributions
const axios = require('axios')
const dayjs = require('dayjs')
const cheerio = require('cheerio')
const gainStarsSum = async user => {
const res = await axios.get(`https://api.github.com/users/${user}/repos`)
const repos = res.data
const starsSum = repos.map(repo => repo.stargazers_count).reduce((a, b) => a +b)
console.log(`User ${user} gain ${starsSum} stars.`)
return starsSum
@zthxxx
zthxxx / filebeat.yml
Created May 23, 2019 03:27
filebeat config (json)
filebeat.prospectors:
- input_type: log
paths:
- /var/log/project/*.log
json.keys_under_root: true
json.add_error_key: true
json.overwrite_keys: true
output.kafka: