Skip to content

Instantly share code, notes, and snippets.

Avatar

Bryan Ellerbrock bellerbrock

View GitHub Profile
@bellerbrock
bellerbrock / gist:156ef0af4eed2a023b973d32212292af
Last active Jan 15, 2020
Handy breedbase db migration commands
View gist:156ef0af4eed2a023b973d32212292af
# skips first sp_person_id to exclude admin account
psql -U postgres -h breedbase_db <db_name> -c "\copy (SELECT * FROM sgn_people.sp_person where sp_person_id > 1) TO STDOUT" > people.tsv
psql -U postgres -h breedbase_db <db_name> -c "COPY sgn_people.sp_person FROM STDIN" < people.tsv
# Grant usage on all schemas to web_usr
DO $do$
DECLARE
sch text;
BEGIN
FOR sch IN SELECT nspname FROM pg_namespace
@bellerbrock
bellerbrock / gist:2248f83417fb71ca712fa10025a33bee
Last active Dec 6, 2019
Sending confirmation emails via SMTP
View gist:2248f83417fb71ca712fa10025a33bee

Notes about confirmation email troubleshooting.

Confirmation emails sent with the local hostname go to spam, and Mail::Sendmail does seem to support SMTP auth very well. I could not get Mail::Sendmail to work with smtp.gmail.com. I also had no luck with Email::Sender::Transport::SMTP which is already a dependency, or Email::Sender::Transport::SMTPS

The best soultion I've found is Email::Send::SMTP::Gmail which works well and has bonus features like support for file attachments. To use it, install it (cpanm Email::Send::SMTP::Gmail) and make sure the gmail account being used for login has the 'allow access for less secure apps' setting turned on.

Here's a test script for proof of concept:

@bellerbrock
bellerbrock / Enable logging in RTT
Last active Mar 19, 2020
Enable logging in RTT
View Enable logging in RTT
# Add to beginning of cgi:
import logging
import pprint
import config
pp = pprint.PrettyPrinter(indent=4)
logging.basicConfig(filename=config.ROOT_PATH+"/rtt.log", level=logging.DEBUG)
# Add debugging print statements like this
@bellerbrock
bellerbrock / new_system_config.txt
Last active Oct 17, 2019
New system configuration
View new_system_config.txt
Install Rstudio
Install Peek
Install VirtualBox
Install Android Studio
sudo apt install docker.io
sudo apt install htop
Setup .bash_aliases
@bellerbrock
bellerbrock / sgn_local.conf
Created Oct 16, 2019
Default example of sgn_local.conf
View sgn_local.conf
dbhost breedbase-db
dbname breedbase
dbuser postgres
dbpass postgres
rootpath /home/production/cxgn
basepath /home/production/cxgn/sgn
composable_cvs trait,toy
composable_cvs_allowed_combinations Time Series|trait+toy
@bellerbrock
bellerbrock / bash_aliases.txt
Last active Oct 17, 2019
Handy general aliases and for working with breedbase docker containers
View bash_aliases.txt
#breedbase
alias log='tail -f -n 100 /var/log/sgn/error.log'
#docker commands
alias drm='docker stop $(docker ps -qa) && docker rm $(docker ps -qa) && docker image rm $(docker images) && docker volume rm $(docker volume ls)' # && docker ps -a && docker images && docker volume ls'
alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Image}}"'
alias dpsa='docker ps -a'
alias dstart='docker start $(docker ps -qa)'
alias dstop='docker stop $(docker ps -qa)'
@bellerbrock
bellerbrock / breedbase_docker_deployment.txt
Last active Oct 21, 2019
Deploying breedbase via docker
View breedbase_docker_deployment.txt
#Docker deployments are now even easier and handled via docker-compose
git clone https://github.com/solgenomics/breedbase_dockerfile.git
cd breedbase_dockerfile
# For development
./prepare.sh
mkdir archive
mv sgn_local.conf.template sgn_local.conf # Edit default and add web_usr password
sudo docker-compose up -d
View gist:e936e6f1595c5552c60e715c9576dfc2
# starting in the cxgn directory clone or pull the latest updates in the sgn and Chado repos
git clone https://github.com/solgenomics/sgn.git
git clone https://github.com/GMOD/Chado.git
# Load the ontology terms
# If you get a message about missing packages it may be necessary to add to Chado modules to perl5lib: export PERL5LIB=/home/production/cxgn/Chado/chado/lib:$PERL5LIB
perl Chado/chado/bin/gmod_load_cvterms.pl -H db4.sgn.cornell.edu -D sandbox_batatabase -s TIME -d Pg -r postgres -p <PASSWORD> -n cxgn_time_ontology -u -v sgn/ontology/cxgn_time.obo
View Running schemaspy
1. Download the latest schemaspy release from https://github.com/schemaspy/schemaspy
2. Check your java installation, and if not installed already install the required version of java. In this case java 8
To check:
java -version
update-alternatives --list java
To install: (from https://www.vultr.com/docs/how-to-manually-install-java-8-on-ubuntu-16-04)
You can’t perform that action at this time.