Skip to content

Instantly share code, notes, and snippets.

View zfhxi's full-sized avatar
🎯
Focusing

zfhxi zfhxi

🎯
Focusing
View GitHub Profile
@zfhxi
zfhxi / MarkUnreadEmails.scpt
Created July 5, 2022 11:07 — forked from edenwaith/MarkUnreadEmails.scpt
An AppleScript to go through the mailboxes in Outlook and mark unread messages as read
-- 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
@zfhxi
zfhxi / markdown-details-collapsible.md
Created February 17, 2022 16:05 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@zfhxi
zfhxi / setup_wol.sh
Created December 31, 2021 01:49 — forked from paddy74/setup_wol.sh
Setting up wake-on-lan on Arch
#!/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
@zfhxi
zfhxi / modify_interpreter.sh
Last active March 15, 2023 16:19
批量替换复制conda环境时bin文件默认解释器
#!/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
@zfhxi
zfhxi / .LOSC.sh
Created September 13, 2021 16:37
Linux非root用户判断当前SSH会话是否为开机后的第一次连接
#!/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"
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
@zfhxi
zfhxi / t.sh
Created December 4, 2020 16:24 — forked from likohank/t.sh
shell 判断某个元素是否在数组中,查看某个key是否存在
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
@zfhxi
zfhxi / Valine-index.js
Created April 24, 2020 09:23
Valine For Name, mail and site checking
let checkInput = (inpStr, inpType) => {
var hashCN = {
mail: "邮箱",
link: "网址",
nick: "昵称",
comment: "评论"
}
var hashREG = {
mail: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
link: /.*/,