Skip to content

Instantly share code, notes, and snippets.

View agalea91's full-sized avatar

Alexander Galea agalea91

View GitHub Profile
@agalea91
agalea91 / squid_proxy_setup.txt
Last active April 6, 2024 06:37
Squid proxy setup on linux server (NO WARRANTY)
# https://linuxize.com/post/how-to-install-and-configure-squid-proxy-on-ubuntu-20-04/
# Install squid
sudo apt update
sudo apt install squid
# Backup config
sudo cp /etc/squid/squid.conf{,.orginal}
# Add allowed IPs
@agalea91
agalea91 / requirements.txt
Created March 3, 2019 22:13
My default requirements.txt file
# Local package
-e .
# Utils
tqdm
click
# Data analysis
numpy
pandas
@agalea91
agalea91 / curl_auth_alias.sh
Created January 12, 2024 16:06
Helpful curl alias for authenticated command line requests
alias gcurl='curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json"'
gcurl <URL>
@agalea91
agalea91 / easylogging.py
Created January 1, 2024 02:34
Python logging setup (that doesn't suck)
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s;%(levelname)s;%(message)s")
logger = logging.getLogger(Path().resolve().parent.name)
@agalea91
agalea91 / default_app_file_mac.sh
Created December 29, 2023 01:44
Change default app to open file on Mac with duti
# Get app ID
osascript -e 'id of app "TextMate"'
# Set default app, e.g. for JSON files
duti -s com.macromates.TextMate .json all
# Install
brew install duti
@agalea91
agalea91 / install_llama_mac.md
Last active November 15, 2023 18:23
Install LLaMA2 GPU on Mac Silicon
@agalea91
agalea91 / docker_python_interpreter.sh
Created October 30, 2023 13:45
Launch python interpreter with docker
docker container run -it --rm python:3.8-slim
@agalea91
agalea91 / create_jupyter_nb_venv.txt
Last active August 9, 2023 19:46
Create virtual environment for Jupyter Notebook
# Creating a virtual env kernel
# -----------------------------
$ python -m venv .venv
$ source .venv/bin/activate
(.venv) $ pip install ipykernel
(.venv) $ python -m ipykernel install --user --name=proj-name
# Managing the kernel
# -----------------------------
$ jupyter kernelspec list
@agalea91
agalea91 / github_deploy_key_setup.md
Created June 24, 2020 15:59
How to setup a deploy key for repo on shared server environment

GitHub Deploy Key Setup

  1. Generate key
ssh-keygen
...
cp ./key-name* ~/.ssh
  1. Go to GitHub repo and add key-name.pub
@agalea91
agalea91 / extract_sitemap_urls.sh
Created October 14, 2022 18:05
Extract sitemap urls using command line
curl SITEMAP_URL > sitemap.xml
cat sitemap.xml | grep -o 'loc\>.*</loc' | sed 's/loc>//g' | sed 's/<\/loc//g' > sitemap_urls.csv