Skip to content

Instantly share code, notes, and snippets.

View erikvw's full-sized avatar

Erik van Widenfelt erikvw

  • Austin
View GitHub Profile
@erikvw
erikvw / gist:397eee3e446f759f07f97d34d1101af9
Last active March 24, 2024 20:04
Multipass on Apple M1: Python 3.12 venv
# Running multipass on a mac (M1)
# minconda won't work since the conda does not support a linux os on M1
# use pyenv to get the python version need (3.12 here)
# use python venv to creat a virtual environment
# install pyenv
sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
curl https://pyenv.run | bash
@erikvw
erikvw / odbc_on_mac.md
Last active April 14, 2023 17:08
mysql, ODBC, STATA 16 on MAC (M1 Silicon)
# Got ...
#
#ImportError: dlopen(/Users/erikvw/miniconda3/envs/edc-dev/lib/python3.9/site-packages/cups.cpython-39-darwin.so, 0x0002): Symbol not found: _libiconv
# Referenced from: /Users/erikvw/miniconda3/envs/edc-dev/lib/python3.9/site-packages/cups.cpython-39-darwin.so
# Expected in: /usr/lib/libiconv.2.dylib
#
#
# Before building pycups ...
# install cups from brew
AWS_ACCESS_KEY_ID=
AWS_DEFAULT_ACL=None
AWS_ENABLED=False
AWS_LOCATION=mocca/static
AWS_S3_CUSTOM_DOMAIN=
AWS_S3_ENDPOINT_URL=
AWS_SECRET_ACCESS_KEY=
AWS_STORAGE_BUCKET_NAME=
CDN_ENABLED=False
@erikvw
erikvw / .bash_profile
Last active February 5, 2020 07:58
Bash profile to show git branch
export PS1="\u@\h:\w$ "
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\*\1/'
}
if [ "$color_prompt" = yes ]; then
PS1='\[\033[01;36m\]\u@\[\033[00m\]:\[\033[01;33m\]\w\[\033[0;35m\]-($(parse_git_branch))\[\033[00m\]\$ '
else
PS1='\u@\h:\w$(parse_git_branch)\$ '
. "$HOME/.duplicity/.env_variables.conf"
duplicity list-current-files $AWS_ENDPOINT/$AWS_BUCKET
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
unset AWS_ENDPOINT
unset AWS_BUCKET
unset GPG_KEY
unset PASSPHRASE
# restores archive file to the given folder.
# then run mysql dbname < archive_file.sql
. "$HOME/.duplicity/.env_variables.conf"
# note will fail if file exists
duplicity --verbosity info \
--encrypt-sign-key=$GPG_KEY \
--log-file $HOME/.duplicity/info.log \
--file-to-restore $1 \
@erikvw
erikvw / .env_variables.conf
Created August 7, 2018 00:05
Sample .duplicity/.env_variables.conf
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export AWS_BUCKET=
export AWS_ENDPOINT=
export GPG_KEY=
export PASSPHRASE=
export DB_NAME=
export DB_DATE=$(date +%Y%m%d%H%M%S)
export BACKUP_DIR=$HOME/mysql_backup/
export DB_FILE=$BACKUP_DIR$DB_NAME-$DB_DATE.sql
@erikvw
erikvw / backup.sh
Last active August 7, 2018 00:03
Backup mysql using duplicity
#!/bin/bash
# ######################################################
# Use duplicity to backup all files in BACKUP_DIR
#
# 1. run mysqldump
# 2. transfer all *.sql files to AWS_BUCKET w/ duplicity
# 3. remove all files older than 7 days
#
# ######################################################
@erikvw
erikvw / update_edc.sh
Last active March 10, 2020 05:09
Update a clinicedc deployment
migrate=""
update_permissions=""
update_ubuntu=""
green=`tput setaf 2`
reset=`tput sgr0`
eval "$(conda shell.bash hook)"
read -p "Version? [master]" version
if [ "${version}" = "" ]; then