Web scrapers on the internet
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
from argparse import ArgumentParser | |
import subprocess | |
import yaml | |
try: | |
import pip_chill | |
except ModuleNotFoundError: | |
print("module 'pip-chill' is not installed, but is required for this script.") | |
if __name__ == "__main__": |
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 | |
port=$PROCESS_PORT # You can add `export PROCESS_PORT=8888` to your bashrc and then use it here. Or just memorize number. | |
screen_name=process_name | |
# An example command. Chained commands MUST be separated by ; (in my experience, && will cause the `screen stuff` command to fail) | |
cmd="cd ~/your/project/directory; jupyter lab --port=$port" | |
# Run only if screen doesn't exist | |
if ! screen -ls | grep -q $screen_name; then | |
# Start detached screen and run command in the screen | |
screen -dmS $screen_name bash -c "$cmd" |
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
import sys | |
import yaml | |
from parse_yaml import parse | |
with open("guild.yml", "r") as f: | |
res = parse(yaml.safe_load(f)) | |
d = {f"--{k.replace('_','-')}": str(v) for k, v in res.items()} | |
if d["--toggle-var-on"] == 'False': | |
del d["--toggle-var-on"] |
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 | |
# Reference: https://stackoverflow.com/a/48133859/1888794 | |
# fileid is the part of the link to the artifact: https://drive.google.com/file/d/<FILEID>/view? | |
FILEID=$1 | |
FILENAME=$2 | |
curl -c ./cookie -s -L "https://drive.google.com/uc?export=download&id=${FILEID}" > /dev/null | |
curl -Lb ./cookie "https://drive.google.com/uc?export=download&confirm=`awk '/download/ {print $NF}' ./cookie`&id=${FILEID}" -o ${FILENAME} | |
rm cookie |
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
aggressive | |
aloof | |
arrogant | |
belligerent | |
bi | |
headed | |
bitchy | |
boastful | |
bon | |
idle |