Skip to content

Instantly share code, notes, and snippets.

View garywill's full-sized avatar
🌴
This year spending even less time on Github. Will reply but don't expect soon!

Garry W garywill

🌴
This year spending even less time on Github. Will reply but don't expect soon!
View GitHub Profile
@garywill
garywill / web-servers.md
Created January 1, 2018 05:27 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@garywill
garywill / gist:428d669f12277eeb6653f88eee4d8190
Last active January 23, 2018 12:02
statistic files mime types
find .|file -i -b -f - |sort|uniq -c|sort -nr
@garywill
garywill / Podcast Bookmarklet.js
Created February 20, 2018 04:24 — forked from zhimiaoli/Podcast Bookmarklet.js
将喜马拉雅、荔枝FM转换成可订阅XML地址
javascript:(function(){if ((Id = /^http:\/\/www\.lizhi\.fm\/(\d{2,})/.exec(window.location.href))!== null) {prompt('http://nj.lizhi.fm/rss/'+Id[1]+'.xml');}else if ((Id = /^http:\/\/www\.ximalaya\.com\/.*\/album\/(\d{2,})/.exec(window.location.href))!== null) {prompt('URL','http://ximalaya.com/album/'+Id[1]+'.xml');}else if ((Id = /^http:\/\/lebo\.baidu\.com\/album\/(\d{2,})/.exec(window.location.href))!== null) {prompt('http://lebo.baidu.com/dj/rss/'+Id[1]);}else if ((Id = /^https:\/\/itunes\.apple\.com\/[a-zA-Z]+\/podcast\/.*/.exec(window.location.href))!== null) {alert('Wait a minute and check the result.');prompt('picklemonkey.net/flipper/extractor.php?feed='+window.location.href);}else{alert('Not support or wrong url!');}})()
@garywill
garywill / install-office2013.sh
Created February 23, 2018 14:24 — forked from ukos-git/install-office2013.sh
install microsoft office 2013 pro
#!/bin/bash
check_wine() {
if ! wine --version | grep -e 'wine-2'
then
echo "consider installing wine-2.1"
apt-cache policy wine32 wine-development
exit 1
fi
}
@garywill
garywill / google-account-record
Last active April 18, 2018 10:36
Google records all your action. Google storage all your privacy
See what your privacy google has kept on your google account.
Google gives option to stop recording and delete them.
https://myaccount.google.com/activitycontrols
https://myactivity.google.com/myactivity
https://myactivity.google.com/more-activity
https://myactivity.google.com/delete-activity
@garywill
garywill / firefoxforks
Last active January 23, 2021 05:30
firefox forks
Palemoon
Cyberfox
waterfox
seamonkey
https://github.com/fork-maintainers/iceraven-browser
grep -E -v "#|radd|rremove" /var/log/zypp/history |cut -d "|" -f 1,2,3,4,5,6 | sed "s/|/,\t/g"
#! /bin/bash
# display the packages included in the installed patterns.
# You'll only have to install the patterns - not the packages!
for pat in $(zypper pt -i | awk -F "|" '/^i/ { print $2 }' | sort -u | sed 's/^ //;s/ *$//;s/ /#/g') ; do
pkg=$(zypper info -t pattern "${pat//#/ }" | awk 'BEGIN { ORS=" "} ; /^i/&&/| package |/{ print $3 }')
[ "$pkg" ] || continue
printf "* %s\n%s\n\n" "${pat//#/ }" "$pkg"
pkgs="$pkgs $pkg"
done
@garywill
garywill / fd_w_f.sh
Created November 21, 2018 03:43
bash get fd with temporary file in memory linked
#!/bin/bash
get_fd() {
local x
local tmpfile
local _fd_var=$1
for x in $(seq 10 $(ulimit -n)); do
if [[ ! -a "/proc/$BASHPID/fd/$x" ]]; then
tmpfile=$(mktemp /dev/shm/XXX.tmp)
@garywill
garywill / batch_compress_photo.sh
Last active April 11, 2024 07:03
imagemagick batch compress jpg photo, output to another path. Keep original folder and sub-folders structure. And video (ffmpeg h265)
#!/bin/bash
# 用法 usage:
# shell置于总放照片的目录之上 put this shell in a path containing original photos (photos are here or in subfolders)
# 脚本 目标文件夹 源文件夹1 源文件夹2 源文件夹3 .....
# scriptname <dest> <source1> <source2> <source3> ....
function get_filename_from_path()
{
echo ${1##*/}