Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
for ((i=0; i<256; i++)); do
printf "\e[48;5;${i}m %03d \e[0m" $i
(((i + 3) % 6 == 0 )) && printf '\n'
done
#!/bin/bash
# file: args.sh
# date: 2018-08-17
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
LIST=(1 ' 2 3')
at(){
for i in $@; do
#!/bin/bash
# file: rsync-repo.sh
# date: 2018-07-18
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
LOCAL_DIR="/path/ubuntu"
MIRROR_SRC="rsync://archive.ubuntu.com/ubuntu/"
DISTS="bionic bionic-backports bionic-proposed bionic-security bionic-updates"
COMPONENTS="main restricted universe multiverse"
#!/bin/bash
# file: migrate_github_plugin.sh
# date: 2018-06-30
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
search_account_meta(){
grep -r "$*" ??/|awk -F':' '{print $1}'|uniq
}
@nanpuyue
nanpuyue / mount.ntfs
Last active September 15, 2018 14:53
mount ntfs partition by ufsd
#!/bin/sh
# file: /sbin/mount.ntfs
# date: 2018-05-26
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
if modprobe -q ufsd; then
exec mount -t ufsd "$@"
else
exec mount -t ntfs-3g "$@"
date: 2018-05-26
license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
author: nanpuyue <[email protected]> https://blog.nanpuyue.com
source:http://dl.paragon-software.com/free/Paragon-715-FRE_NTFS_Linux_9.5_Express.tar.gz
---
diff -u a/ifslinux/ufsdvfs.c b/ifslinux/ufsdvfs.c
--- a/ifslinux/ufsdvfs.c 2017-09-09 00:06:41.000000000 +0800
+++ b/ifslinux/ufsdvfs.c 2018-05-26 14:39:23.392496043 +0800
@@ -112,6 +112,10 @@
#include <linux/kthread.h>
@nanpuyue
nanpuyue / you-get.sh
Created April 18, 2018 15:02
a you-get gui
#!/bin/bash
# file: you-get.sh
# date: 2018-04-18
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
URL=$(zenity --entry --text=请输入视频地址)
INFO=$(you-get -i "$URL"|sed 's/\x1b\[\wm//g')
TITLE="$(echo "$INFO"|grep -Po '(?<=title:).*'|sed -r 's/^\s*//')"
LIST=$(echo "$INFO"|grep -Po 'format:.*$|(?<=video-profile:).*$|(?<=size:).*MiB|(?<=container:).*$'|\
@nanpuyue
nanpuyue / ipsec-updown.sh
Last active April 6, 2018 14:50
for OpenWrt
#!/bin/sh
# file: ipsec-updown.sh
# date: 2018-04-06
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
VERBOSE=1
RETRY=10
TIMEOUT=40
CHECK_INT=30
#!/bin/bash
# file: dl_qt_example.sh
# date: 2018-03-21
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <[email protected]> https://blog.nanpuyue.com
URL="http://doc.qt.io/qt-5/qtwidgets-itemviews-frozencolumn-example.html"
BASE_URL=${URL%/*}
curl -so- "$URL"|\
@nanpuyue
nanpuyue / iptc_test.c
Last active March 19, 2018 04:26
iptables -A OUTPUT -s 192.168.1.100/32 -m limit --limit 200/sec --limit-burst 10 -j ACCEPT
/*
* file: iptc_test.c
* date: 2018-03-19
* license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
* author: nanpuyue <[email protected]> https://blog.nanpuyue.com
* compile: gcc -lip4tc iptc_test.c -o iptc_test
*/
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>