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 numpy as np | |
from sklearn.decomposition import FactorAnalysis | |
from sklearn.preprocessing import StandardScaler | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
# --- Parameters --- | |
# Spearman's early work involved small numbers of tests/variables and modest samples. | |
n_subjects = 200 # Number of simulated individuals |
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
#!/usr/bin/env -S uv run --script | |
# /// script | |
# requires-python = ">=3.11" | |
# dependencies = [ | |
# "python-dotenv", | |
# "openai", | |
# ] | |
# /// | |
import os |
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
#!/usr/bin/env -S uv run --script | |
# /// script | |
# requires-python = ">=3.8" | |
# dependencies = [ | |
# "opencv-python>=4.5.0", | |
# "numpy>=1.20.0", | |
# "pillow>=8.0.0", | |
# ] | |
# /// |
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 | |
# Check if an input file was provided | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <input.mp3>" | |
exit 1 | |
fi | |
input_file="$1" |
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 | |
# Check if a filename was provided | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <pdf-file>" | |
exit 1 | |
fi | |
# Convert to absolute paths | |
input_pdf=$(realpath "$1") |
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
#!/usr/bin/env -S uv run --script | |
# /// script | |
# requires-python = ">=3.12.2" | |
# dependencies = [ | |
# "deepface", | |
# "pandas==2.2.3", | |
# "tqdm==4.67.1", | |
# "opencv-contrib-python==4.10.0.84", | |
# "tensorflow==2.18.0", | |
# "keras==3.7.0", |
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
# From https://xiaoxing.us/2018/09/04/creating_swap_on_lightsail/ | |
# fallocate is instant; no point wasting time writing zeroes | |
sudo fallocate -l 8G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo cp /etc/fstab /etc/fstab.bak | |
# Activate swap on boot | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab |
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
echo "Creating an SSH key for you..." | |
ssh-keygen -t rsa -b 2048 | |
echo "Please add this public key to Github \n" | |
echo "https://github.com/account/ssh \n" | |
echo "and to virtual servers\n" | |
read -p "Press [Enter] key after this..." | |
echo "Installing xcode-stuff" | |
xcode-select --install |
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 random | |
donkey = 0 | |
car = 10 # car is worth more than a donkey | |
prizes = [car, donkey, donkey] # there's always exactly one car | |
N = 1000000 | |
def pick_a_door(prizes): |
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
# wget https://github.com/xtaci/kcptun/releases/download/v20170525/kcptun-linux-amd64-20170525.tar.gz | |
# tar xvf kcptun-linux-amd64-20170525.tar.gz | |
mv server_linux_amd64 /usr/local/bin/kcptun_server | |
mv /usr/local/bin/server_linux_amd64 /usr/local/bin/kcptun_server | |
sudo mkdir -p /etc/kcptun | |
sudo bash -c "cat <<EOT > /etc/kcptun/server_conf.json | |
{ | |
\"listen\": \":21\", | |
\"target\": \"127.0.0.1:20001\", |
NewerOlder