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
(*Shanghai Composite Index*) | |
data1 = FinancialData[ | |
"^000001", {{2019, 12, 1}, {2021, 3, 22}, "Week"}]; | |
data2 = FinancialData[ | |
"^000001", {{2021, 3, 23}, {2022, 3, 5}, "Week"}]; | |
data3 = FinancialData[ | |
"^000001", {{2022, 3, 6}, {2022, 12, 4}, "Week"}]; | |
data4 = FinancialData[ | |
"^000001", {{2022, 12, 5}, {2023, 11, 1}, "Week"}]; | |
dataset = {data1, data2, data3, data4}; |
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 | |
# Tom Hale, 2016. MIT Licence. | |
# Print out 256 colours, with each number printed in its corresponding colour | |
# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163 | |
set -eu # Fail on errors or undeclared variables | |
printable_colours=256 |
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
local GH_RAW_URL='https://raw.githubusercontent.com' | |
install_completion(){ zinit for as'completion' nocompile id-as"$1" is-snippet "$GH_RAW_URL/$2"; } | |
local GHG_RAW_URL='https://gist.githubusercontent.com' | |
install_gist_snippet() { | |
local url="$2" | |
if [[ $url != $GHG_RAW_URL* ]]; then | |
url="$GHG_RAW_URL/$url" | |
fi | |
if [[ $url != *raw ]]; then |
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
# ZINIT_HOME="/home/username/.local/share/zinit/zinit.git" | |
zinit_remove() { | |
local target_dir | |
case "$1" in | |
-s|--snippets) | |
target_dir="${ZINIT_HOME:s/zinit\.git/snippets}" | |
;; | |
-p|--plugins) |
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
function ipinfo() { | |
ip_address=${1:-$(curl -s ipinfo.io/ip)} | |
while (( "$#" )); do | |
case $1 in | |
-h|--help) | |
echo "Command: ip-info IP_ADDRESS\n" | |
echo "Default: your ip address" | |
echo "Option -s or --simple" | |
echo "==>Print only Your address" |
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
load_func() { | |
local CMD_NAME="$1" | |
local SCRIPT_URL="$2" | |
local SAFETY_CHECK="${3:-true}" | |
local script=$(curl -fsSL $SCRIPT_URL) | |
if [[ "$SAFETY_CHECK" == "true" && $script =~ "rm " ]]; then | |
echo "Failed to load command $CMD_NAME: Harmful command detected in script." | |
return 1 | |
else |
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 | |
# Get the architecture of the machine | |
arch=$(uname -m) | |
os=$(uname -s) | |
# Download the Zellij binary | |
if [ "$os" == "Darwin" ]; then | |
filename="zellij-${arch}-apple-darwin.tar.gz" | |
url="https://github.com/zellij-org/zellij/releases/latest/download/$filename" |
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
function git_user_switcher() { | |
# Define an associative array to store the user settings | |
typeset -A -g git_users | |
# Add the users to the dictionary | |
# Format: username "name email gpg_key" | |
git_users=( | |
adam "adam adam@baksili.codes" | |
) |
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
alias undock='f() { | |
if sudo docker kill $1; then | |
echo "[+] Successfully killed: $1" | |
else | |
echo "[-] Failed to kill: $1" | |
fi | |
if sudo docker rm $1; then | |
echo "[+] Successfully removed: $1" | |
else |
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
note_type = 'Basic' | |
regex = r'\[sound:.*\]' | |
field_from = 'Back' | |
field_to = 'Pronunciation' | |
model = mw.col.models.by_name(note_type) | |
notes = mw.col.models.nids(model) | |
for nid in notes: | |
note = mw.col.get_note(nid) |
NewerOlder