Skip to content

Instantly share code, notes, and snippets.

View ksuderman's full-sized avatar

Keith Suderman ksuderman

View GitHub Profile
@ksuderman
ksuderman / GitHub Import
Created September 3, 2013 23:27
How to import an existing project into GitHub
Every time I want to import an existing project into GitHub I have to Google for the instructions. Hopefully this gist will be easier for me to find...
1. Create a new repository on GitHub and make note of the URL. The URL will be something like https://github/ksuderman/org.anc.some.project.git (don't forget the .git extension).
2. CD to the root on your project source code.
3. git init
4. git add . (or explicityly specify directories and files to be added).
5. git commit -m "Initial code import."
6. git remote add origin [URL] (where [URL] is the URL from step one)
7. git pull origin master
8. git push origin master
@ksuderman
ksuderman / whereami.sh
Last active July 25, 2018 18:48
Find the source directory of a bash script
# See http://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@ksuderman
ksuderman / password.sh
Last active March 1, 2021 15:23
Generate a random string. Useful for generating system passwords
secret=`cat /dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;`
echo $secret
# If tr complains about illegal byte sequences it is because tr can not handle UTF-8 characters.
# The solution is to specify the C locale for tr
secret=`cat /dev/urandom | LC_ALL=C tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;`
echo $secret
@ksuderman
ksuderman / tensor-config.json
Created June 26, 2020 15:49
COVID-19 Dataset for TensorBoard
{
"embeddings": [
{
"tensorName": "Covid-19 Dataset",
"tensorShape": [
1000,
50
],
"tensorPath": "https://www.lappsgrid.org/tensors/model300_5_5_50_cbow_abs_intro.tsv",
"metadataPath": "https://www.lappsgrid.org/tensors/metadata.txt"
@ksuderman
ksuderman / tools.yml
Created March 30, 2021 21:44
Latest Tools
tools:
- name: sra_tools
owner: iuc
revisions:
- f5ea3ce9b9b0
- e08a7ad4378b
tool_panel_section_label: Get Data
tool_shed_url: toolshed.g2.bx.psu.edu
- name: ncbi_acc_download
owner: iuc
@ksuderman
ksuderman / gxadmin
Created July 20, 2021 22:36
My version of gxadmin
#!/bin/bash
# gxadmin: Galaxy administration swiss army knife
# license: GPLv3
#
# This is the result of admins across the universe working together :)
#
# Thanks to everyone for their contributions
# https://github.com/galaxyproject/gxadmin/graphs/contributors
version() {
echo 19
@ksuderman
ksuderman / run_workflow.py
Last active July 23, 2021 18:45
Example of running a Galaxy workflow with BioBlend
"""
This script is loosely based on https://github.com/galaxyproject/bioblend/blob/main/docs/examples/run_imported_workflow.py
TO-DO
1. Allow the user to specify an output history.
2. Maybe allow the user to specify a URL to data that should be uploaded to
the server to be used as input to the workflow.
3. Don't assume the name of the input parameter is 'input'
usage: workflows.py [-h] [-s SERVER] [-a API_KEY] -w WORKFLOW -d DATASET
@ksuderman
ksuderman / bumpleo
Created August 15, 2022 18:11
Updates the GalaxyKubeman versions in Leo
#!/usr/bin/env bash
# Use this script to update the GalaxyKubeman Helm chart versions in Leo
#
# Put this script on your path and run from the root Leonardo source directory.
# > cd /home/user/leonardo
#
# USAGE
# > bumpleo <new version>
#
@ksuderman
ksuderman / sample_help.sh
Last active February 1, 2023 12:37
Print simple help with ANSI highlighting
# ANSI color codes for the console.
reset="\033[0m"
bold="\033[1m"
ital="\033[3m" # does not work on OS X
# Function used to highlight text.
function hi() {
echo -e "$bold$@$reset"
}
@ksuderman
ksuderman / abm_sample.csv
Created September 27, 2022 21:27
Sample ABM output
job_id tool_id tool_version state memory.max_usage_in_bytes cpuacct.usage process_count galaxy_slots runtime_seconds ref_data_size input_data_size
ce4eadcc6a9dc62d toolshed.g2.bx.psu.edu/repos/iuc/hisat2/hisat2/2.1.0+galaxy7 2.1.0+galaxy7 ok 10230325248.0000000 1524636164586.0000000 32.0000000 1.0000000 1467.0000000 0 1407644464
b944eb0f5f220e64 toolshed.g2.bx.psu.edu/repos/iuc/minimap2/minimap2/2.24+galaxy0 2.24+galaxy0 ok 23552430080.0000000 1284559376976.0000000 32.0000000 1.0000000 1242.0000000 0 1407644464
8510271abb9e802c toolshed.g2.bx.psu.edu/repos/devteam/bowtie2/bowtie2/2.4.2+galaxy0 2.4.2+galaxy0 ok 8763760640.0000000 5420490778352.0000000 32.0000000 1.0000000 5462.0000000 0 1407644464
7c2d1b475743f5b6 toolshed.g2.bx.psu.edu/repos/devteam/bwa/bwa_mem/0.7.17.1 0.7.17.1 ok 12500324352.0000000 9858370786969.0000000 32.0000000 1.0000000 9451.0000000 0 1407644464