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
patch: | |
switches: | |
- name: ascii_mode | |
reset: 0 | |
states: [中文, 英文] | |
- name: full_shape | |
states: [半角, 全角] | |
- name: extended_charset | |
states: [通用, GBK] | |
- name: simplification |
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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Sqrt(x float64) float64 { | |
z := 1.0 | |
for i := 1; i <= 100; i++ { |
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
filename=`basename "$1"` | |
[[ "$filename" == "Archive" ]] && exit 1 | |
target=`stat -f '%Sc' -t '%Y-%m' "$1"` | |
fullpath="$HOME/Desktop/Archive/$target" | |
mkdir -p "$fullpath" | |
mv "$1" "$fullpath/" | |
script="display notification \"$filename -> Archive/$target\" with title \"Desktop file archived\"" | |
osascript -e "$script" |
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/bash | |
# author: janlay@gmail.com | |
# How to use this script: | |
# 1. To backup your dotfiles, move them to the WORKING_DIR. | |
# 2. To Restore the dotfiles you previously backed up, run this script. | |
WORKDING_DIR="$HOME/Dropbox/dotfiles" | |
echo "Working on $WORKDING_DIR" |
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/bash | |
# author: janlay@gmail.com | |
WORKDING_DIR="${1-$HOME/.vim/bundle}" | |
GIT_DIR_ROOT="$HOME/Workspace/.gitrepo" | |
echo "Working on $WORKDING_DIR" | |
for i in `find "$WORKDING_DIR" -mindepth 1 -maxdepth 1 -type d`; do | |
REPO_NAME="${i##*/}" | |
export GIT_WORK_TREE="$WORKDING_DIR/$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
#!/bin/bash | |
FILE=/etc/chinadns_chnroute.txt | |
TEMP_FILE="$FILE.tmp" | |
TELEGRAM_BOT=/root/scripts/telegram-bot | |
SOURCE="https://raw.githubusercontent.com/ym/chnroutes2/master/chnroutes.txt" | |
LOGFILE=/root/scripts/chinadns-updater.log | |
echo -e "\nChinaDNS Updater started at `date`." >> $LOGFILE | |
echo "Current routes: `wc -l "$FILE" | cut -d' ' -f1`." >> $LOGFILE |
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/bash | |
# author: janlay@gmail.com | |
set -e | |
SERVICE_URL="https://officecdn.microsoft.com/pr/C1297A47-86C4-4C1F-97FA-950631F94777/MacAutoupdate" | |
USER_AGENT='Microsoft%20AU%20Daemon/4.13.19071800 CFNetwork/1098 Darwin/19.0.0 (x86_64)' | |
MS_APPS=( | |
"Microsoft AutoUpdate:0409MSau04" |
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/bash | |
# author: janlay@gmail.com | |
set -e | |
cols=$(bc <<< "$(tput cols) / 3 - 2") | |
char=✾ | |
echo -n ' ' | |
for col in $(seq 0 $cols); do |
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
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\MSEdgePDF\shell\open\command] | |
@="\"C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe\" --disk-cache-dir=R:\\MSEdge -- \"%1\"" | |
[HKEY_CLASSES_ROOT\MSEdgeHTM\shell\open\command] | |
@="\"C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe\" --disk-cache-dir=R:\\MSEdge -- \"%1\"" | |
[HKEY_CLASSES_ROOT\http\shell\open\command] | |
@="\"C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe\" --disk-cache-dir=R:\\MSEdge -- \"%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/bash | |
set -e | |
# Backup db and certs in $BITWARDEN_DIR into $TARGET_DIR/$FILENAME_PREFIX$DATE.tar.gz | |
BITWARDEN_DIR='/volume1/docker/Bitwarden' | |
TARGET_DIR='/var/services/dropbox/Backup/Bitwarden' | |
FILENAME_PREFIX='bw-backup_' | |
FILENAME_DATE_PATTERN='%m-%d' |
OlderNewer