Skip to content

Instantly share code, notes, and snippets.

@bellerbrock
bellerbrock / git-branching-diagram.md
Created May 12, 2023 16:05 — forked from bryanbraun/git-branching-diagram.md
Example Git Branching Diagram

Example Git Branching Diagram

You can use this diagram as a template to create your own git branching diagrams. Here's how:

  1. Create a new diagram with diagrams.net (formerly draw.io)
  2. Go to File > Open From > URL
  3. Insert this url (it points to the xml data below): https://gist.githubusercontent.com/bryanbraun/8c93e154a93a08794291df1fcdce6918/raw/bf563eb36c3623bb9e7e1faae349c5da802f9fed/template-data.xml
  4. Customize as needed for your team.

BEGIN;
UPDATE nd_experiment
SET nd_geolocation_id = 119
WHERE nd_geolocation_id = 52;
UPDATE projectprop
SET value = '119'
WHERE value = '52'
AND type_id = (
# Retrieve NCSU crosses that are missing female_parent stock_relationship
SELECT stock.stock_id, stock.uniquename FROM stock
LEFT JOIN stock_relationship sr ON(
stock.stock_id = sr.object_id
AND sr.type_id = (SELECT cvterm_id FROM cvterm WHERE name = 'female_parent')
)
JOIN nd_experiment_stock s ON(stock.stock_id = s.stock_id)
JOIN nd_experiment_project p ON(s.nd_experiment_id = p.nd_experiment_id)
JOIN project t ON(p.project_id = t.project_id)
JOIN project_relationship pr ON(
@bellerbrock
bellerbrock / Ontology Update example
Last active March 17, 2021 20:51
Ontology Update example
# Start by cloning or pulling the latest updates in the ibp-sweetpotato-traits and Chado repos
git clone https://github.com/Planteome/ibp-sweetpotato-traits.git
git clone https://github.com/GMOD/Chado.git
# Load the ontology terms, then update cvterm paths. 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 CO_331 -d Pg -r postgres -p <PASSWORD> -n SweetpotatoTrait -u -v ibp-sweetpotato-traits/sweetpotato_trait.obo
perl Chado/chado/bin/gmod_make_cvtermpath.pl -H db4.sgn.cornell.edu -D sandbox_batatabase -d Pg -u postgres -p <PASSWORD> -c SweetpotatoTrait
# Example for other ontologies
@bellerbrock
bellerbrock / Enable logging in RTT
Last active March 19, 2020 16:20
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 / gist:156ef0af4eed2a023b973d32212292af
Last active January 15, 2020 18:36
Handy breedbase db migration commands
# 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
license: gpl-3.0
@bellerbrock
bellerbrock / gist:2248f83417fb71ca712fa10025a33bee
Last active December 6, 2019 16:59
Sending confirmation emails via SMTP

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 / gist:e936e6f1595c5552c60e715c9576dfc2
Last active December 4, 2019 18:58
Trait component ontology update
# 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
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)