Auto-update: Tue Jul 30 19:48:25 PDT 2024
This commit is contained in:
parent
221ea91328
commit
f2ee215947
14 changed files with 0 additions and 275 deletions
0
cf
Normal file → Executable file
0
cf
Normal file → Executable file
0
ddns
Normal file → Executable file
0
ddns
Normal file → Executable file
40
sij
40
sij
|
@ -1,40 +0,0 @@
|
|||
#!/bin/zsh
|
||||
# #!/bin/bash
|
||||
source /Users/sij/.zshrc
|
||||
|
||||
# Kill the existing tmux server
|
||||
tmux kill-server
|
||||
sleep 2
|
||||
|
||||
# Create the main session and windows
|
||||
tmux new-session -d -s sijapi -n 'Main'
|
||||
|
||||
# Split the main window into three vertical panes
|
||||
tmux split-window -v -t sijapi:Main
|
||||
#tmux split-window -v -t sijapi:Main
|
||||
tmux select-layout even-vertical
|
||||
|
||||
# Configure API pane (top pane)
|
||||
tmux select-pane -t 0
|
||||
tmux send-keys "cd ~/workshop" C-m
|
||||
tmux send-keys "source ~/.zshrc; sleep 1" C-m
|
||||
tmux send-keys "mamba activate sijapi; while true; do python -m sijapi; sleep 1; done" C-m
|
||||
|
||||
# Configure Khoj (middle pane)
|
||||
tmux select-pane -t 1
|
||||
tmux send-keys "source ~/.zshrc" C-m
|
||||
tmux send-keys "mamba activate khoj; export KHOJ_DOMAIN=ai.sij.ai && export KHOJ_ADMIN_EMAIL=sij@env.esq && export KHOJ_ADMIN_PASSWORD='Synchr0!-K' && export KHOJ_DEBUG=True && export DEBUG=true && while true; do khoj --anonymous-mode; sleep 1; done" C-m
|
||||
|
||||
# Configure Ollama (bottom pane)
|
||||
tmux select-pane -t 1
|
||||
tmux send-keys "cd ~/sync/sijapi/api" C-m
|
||||
tmux send-keys "source ~/.zshrc; sleep 1" C-m
|
||||
tmux send-keys "while true; do export OLLAMA_HOST='0.0.0.0:11434' && export OLLAMA_ORIGINS='*' && ollama serve; sleep 1; done" C-m
|
||||
|
||||
# Create separate session for Syncthing
|
||||
# tmux new-session -d -s syncthing -n 'Syncthing'
|
||||
# tmux send-keys "source ~/.zshrc" C-m
|
||||
# tmux send-keys "while true; do /opt/homebrew/bin/syncthing; done" C-m
|
||||
|
||||
# Attach to the main tmux session
|
||||
tmux attach-session -t sijapi
|
23
ssh-scrape
23
ssh-scrape
|
@ -1,23 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "Error: No command provided."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
variant=$1
|
||||
shift # Remove the first argument, which is now stored in 'variant'
|
||||
additional_params="$@" # Remaining arguments
|
||||
|
||||
quoted_params=""
|
||||
for param in "$@"; do
|
||||
quoted_params+="\"$param\" "
|
||||
done
|
||||
|
||||
session_name="scrape-$(date +%Y%m%d%H%M%S)"
|
||||
tailscale up
|
||||
tmux new-session -d -s "$session_name"
|
||||
ssh_command="ssh -t sij@vm 'tmux new-session -d -s \"$session_name\" \"/usr/local/bin/scrape ${variant} ${quoted_params}\"; tmux attach-session -t \"$session_name\"'"
|
||||
tmux send-keys -t "$session_name" "$ssh_command" C-m
|
||||
tmux attach-session -t "$session_name"
|
||||
|
5
st
5
st
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
tmux new-session -d -s syncthing -n syncthingpane
|
||||
tmux select-pane -t 0
|
||||
tmux send-keys -t 0 "/opt/homebrew/bin/syncthing" C-m
|
19
ts-info
19
ts-info
|
@ -1,19 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Function to get exit node details
|
||||
# get_exit_node_details() {
|
||||
# echo $(/Applications/Tailscale.app/Contents/MacOS/Tailscale exit-node list | awk '/'"$1"'/ {print $4", "$3" ("$2")"}')
|
||||
# }
|
||||
|
||||
# Get the current exit node details and public IP
|
||||
# CURRENT_NODE=$(get_exit_node_details 'selected')
|
||||
# CURRENT_IP=$(curl -s ifconfig.me)
|
||||
# DNS_SERVER=$(python3 ~/.dns-info.py)
|
||||
|
||||
# echo "IP address: $CURRENT_IP"
|
||||
# echo "DNS server: $DNS_SERVER"
|
||||
# echo "Exit node: ${CURRENT_NODE:-None}"
|
||||
# echo ""
|
||||
|
||||
READOUT=$(python3 /Users/sij/Scripts/Raycast\ Scripts/vpn-dns-info.py)
|
||||
echo "$READOUT"
|
59
ts-new-node
59
ts-new-node
|
@ -1,59 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TSBINARY=$(which tailscale || echo "tailscale")
|
||||
TSBINARY='/Applications/Tailscale.app/Contents/MacOS/Tailscale'
|
||||
VERBOSE=0
|
||||
|
||||
# Check for -v argument
|
||||
while getopts "v" option; do
|
||||
case $option in
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Function to get exit node details
|
||||
get_exit_node_details() {
|
||||
if [[ $VERBOSE -eq 1 ]]; then
|
||||
echo "$($TSBINARY exit-node list | awk '/'"$1"'/ {print $4", "$3" ("$2")"}')"
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $VERBOSE -eq 1 ]]; then
|
||||
# Get the current exit node details and public IP
|
||||
CURRENT_NODE=$(get_exit_node_details 'selected')
|
||||
CURRENT_IP=$(curl -s ifconfig.me)
|
||||
DNS_SERVER=$(python3 ~/.dns-info.py)
|
||||
|
||||
# Print the current node and IP
|
||||
echo "IP address: $CURRENT_IP"
|
||||
echo "DNS server: $DNS_SERVER"
|
||||
echo "Exit node: ${CURRENT_NODE:-None}"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Select a new exit node
|
||||
SELECTED_NODE=$($TSBINARY exit-node list | grep -v -f ~/.vpnblacklist | awk 'BEGIN {srand()} {print rand() " " $0}' | sort -k1,1n | cut -d ' ' -f2- | awk '{print $2}' | head -n 1)
|
||||
|
||||
# Set the selected node as the exit node
|
||||
$TSBINARY set --exit-node="$SELECTED_NODE"
|
||||
|
||||
if [[ $VERBOSE -eq 1 ]]; then
|
||||
# Wait for the network to update
|
||||
sleep 1
|
||||
|
||||
# Get the new public IP
|
||||
NEW_IP=$(curl -s ifconfig.me)
|
||||
|
||||
# Get the new exit node details
|
||||
NEW_NODE=$(get_exit_node_details "$SELECTED_NODE")
|
||||
|
||||
NEW_DNS=$(python3 ~/.dns-info.py)
|
||||
|
||||
# Print the new node and IP
|
||||
echo "New Public IP address: $NEW_IP"
|
||||
echo "New DNS server: $NEW_DNS"
|
||||
echo "Exit node: ${NEW_NODE:-None}"
|
||||
echo ""
|
||||
fi
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Define the path to your Tailscale binary
|
||||
tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
|
||||
|
||||
# Check if Tailscale is running
|
||||
if ! pgrep "Tailscale" > /dev/null; then
|
||||
echo "Tailscale is not running. Starting Tailscale..."
|
||||
open -a "/Applications/Tailscale.app"
|
||||
# Wait for Tailscale to initialize
|
||||
sleep 5
|
||||
$tailscale up
|
||||
fi
|
||||
|
||||
# Select a new exit node from the whitelist and set it
|
||||
selected_exit_node=$($tailscale exit-node list | grep -f ~/.vpnwhitelist | awk '{print $2}' | shuf -n 1)
|
||||
if [ -n "$selected_exit_node" ]; then
|
||||
# Set the new exit node
|
||||
$tailscale set --exit-node=$selected_exit_node
|
||||
else
|
||||
echo "No valid exit node found."
|
||||
exit 1
|
||||
fi
|
||||
|
3
ts-start
3
ts-start
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
export PATH=/opt/local/bin:/opt/local/sbin:/Users/sangye/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/
|
||||
sudo /opt/homebrew/bin/tailscaled --state=/var/lib/tailscale/tailscaled.state
|
3
ts-tmux
3
ts-tmux
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
export PATH=/opt/local/bin:/opt/local/sbin:/Users/sangye/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.11/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/Users/sangye/.local/bin
|
||||
sudo tmux new-session -d -s tailscale 'ts-start'
|
0
txt-line-merge-abc
Normal file → Executable file
0
txt-line-merge-abc
Normal file → Executable file
|
@ -1,86 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Check if a date parameter is passed
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <YYYY-MM-DD>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DATE=$1
|
||||
|
||||
# Convert the date to a format that AppleScript expects (MM/DD/YYYY)
|
||||
formatted_date=$(date -j -f "%Y-%m-%d" "$DATE" +"%A, %B %e, %Y at 00:00:00")
|
||||
|
||||
osascript <<EOF
|
||||
set targetDate to date "$formatted_date"
|
||||
set endOfTargetDate to targetDate + (1 * days)
|
||||
|
||||
tell application "Calendar"
|
||||
set exportFolder to (POSIX path of (path to home folder)) & "workshop/sijapi/data/" -- Ensure this path is correct
|
||||
set calendarName to "Calendar" -- Replace with the name of your calendar
|
||||
|
||||
if not (exists calendar calendarName) then
|
||||
return
|
||||
end if
|
||||
|
||||
-- Create a temporary calendar
|
||||
set tempCalendar to make new calendar with properties {name:"TempExportCalendar"}
|
||||
|
||||
-- Copy events from the target calendar to the temporary calendar
|
||||
set cal to calendar calendarName
|
||||
set eventsList to (every event of cal whose start date ≥ targetDate and start date < endOfTargetDate) & (every event of cal whose end date ≥ targetDate and end date < endOfTargetDate)
|
||||
|
||||
repeat with eventItem in eventsList
|
||||
-- Create a new event
|
||||
tell tempCalendar
|
||||
set newEvent to make new event with properties {start date:start date of eventItem, end date:end date of eventItem, summary:(summary of eventItem)}
|
||||
end tell
|
||||
|
||||
-- Add optional properties if they exist
|
||||
try
|
||||
set eventLocation to location of eventItem
|
||||
if eventLocation is not missing value then
|
||||
set location of newEvent to eventLocation
|
||||
end if
|
||||
end try
|
||||
|
||||
try
|
||||
set eventDescription to description of eventItem
|
||||
if eventDescription is not missing value then
|
||||
set description of newEvent to eventDescription
|
||||
end if
|
||||
end try
|
||||
|
||||
try
|
||||
set eventSummary to summary of eventItem
|
||||
if eventSummary is not missing value then
|
||||
set summary of newEvent to eventSummary
|
||||
end if
|
||||
end try
|
||||
|
||||
try
|
||||
set eventAttendees to attendees of eventItem
|
||||
if eventAttendees is not missing value then
|
||||
set attendees of newEvent to eventAttendees
|
||||
end if
|
||||
end try
|
||||
|
||||
try
|
||||
set eventURL to url of eventItem
|
||||
if eventURL is not missing value then
|
||||
set url of newEvent to eventURL
|
||||
end if
|
||||
end try
|
||||
end repeat
|
||||
|
||||
-- Export the temporary calendar
|
||||
set exportFile to (exportFolder & "calendar.ics")
|
||||
set exportPath to POSIX path of exportFile
|
||||
do shell script "mkdir -p " & quoted form of exportFolder -- Ensure the folder exists
|
||||
tell tempCalendar to save in exportPath
|
||||
|
||||
-- Delete the temporary calendar
|
||||
delete calendar "TempExportCalendar"
|
||||
end tell
|
||||
EOF
|
||||
|
13
vm
13
vm
|
@ -1,13 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale"
|
||||
# Check if Tailscale is up by looking for a specific output in the tailscale status command.
|
||||
# Adjust the grep search pattern if needed based on your Tailscale setup.
|
||||
if $tailscale status | grep -q "100."; then
|
||||
echo "Connected to Tailscale, SSH'ing to 100.64.64.11..."
|
||||
ssh sij@100.64.64.11
|
||||
else
|
||||
echo "Not connected to Tailscale, SSH'ing to 10.13.37.11..."
|
||||
ssh sij@10.13.37.11
|
||||
fi
|
||||
|
Loading…
Reference in a new issue