This file contains hidden or 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
| -- File: MarkUnreadEmails.scpt | |
| -- Description: Go through the mailboxes in Outlook and mark unread messages as read | |
| -- Author: Chad Armstrong | |
| -- Date: 22 November 2019 | |
| tell application "Microsoft Outlook" | |
| set myInbox to folder "Inbox" of default account | |
| set github to folder "GitHub" of myInbox | |
| set other to folder "Other" of myInbox |
This file contains hidden or 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 | |
| # https://wiki.archlinux.org/index.php/Wake-on-LAN | |
| sudo pacman -Syu ethtool | |
| # d (disabled), p (PHY activity), u (unicast activity), m (multicast activity), | |
| # b (broadcast activity), a (ARP activity), and g (magic packet activity) | |
| ethtool <interface> | grep Wake-on | |
| # If not g | |
| ethtool -s <interface> wol g |
This file contains hidden or 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 | |
| BIN_PATH=$1/bin | |
| PYTHON_INTERPRETER="#!$(realpath $BIN_PATH/python)" | |
| for file in $BIN_PATH/* | |
| do | |
| if [[ $(file -b "$file") == *"Python script"* ]];then | |
| sed -i "1s|.*|$PYTHON_INTERPRETER|g" $file | |
| fi | |
| done |
This file contains hidden or 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 | |
| last_login_timestr=`last username | head -n 2 | awk 'NR==2' |awk '{print $5,$6,$7}'` | |
| last_login_timestamp=`date -d "$last_login_timestr" +%s` | |
| last_boot_timestr=`who -b | awk '{print $3,$4}'` | |
| last_boot_timestamp=`date -d "$last_boot_timestr" +%s` | |
| #echo "$last_login_timestamp" | |
| #echo "$last_boot_timestamp" |
This file contains hidden or 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 re | |
| import os | |
| import requests | |
| from requests.adapters import HTTPAdapter | |
| from requests.packages.urllib3.util.retry import Retry | |
| from time import time | |
| from multiprocessing.dummy import Pool | |
| #下载文件参考 https://cloud.tencent.com/developer/article/1471279 |
This file contains hidden or 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
| if [[ " ${array[@]} " =~ " ${value} " ]]; then | |
| # whatever you want to do when arr contains value | |
| fi | |
| ------------------------------------------------------ | |
| if [[ ! " ${array[@]} " =~ " ${value} " ]]; then | |
| # whatever you want to do when arr doesn't contain value | |
| fi | |
| ------------------------------------------------------ | |
| if [[ " ${!array[@]} " =~ " ${value} " ]]; then | |
| # whatever you want to do when arr contains value |
This file contains hidden or 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
| let checkInput = (inpStr, inpType) => { | |
| var hashCN = { | |
| mail: "邮箱", | |
| link: "网址", | |
| nick: "昵称", | |
| comment: "评论" | |
| } | |
| var hashREG = { | |
| mail: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/, | |
| link: /.*/, |