Skip to content

Instantly share code, notes, and snippets.

View seandavi's full-sized avatar

Sean Davis seandavi

View GitHub Profile
@seandavi
seandavi / go.mod
Created December 30, 2019 15:42
basic go postgres and logging example
module monitor
go 1.13
require (
github.com/jackc/pgx/v4 v4.1.2
github.com/jinzhu/gorm v1.9.11
github.com/joho/godotenv v1.3.0
go.uber.org/zap v1.13.0
)
@seandavi
seandavi / es_dsl_dynamic_mapping.py
Created October 8, 2019 13:15
Working with elasticsearch DSL and dynamic mappings
from elasticsearch import Elasticsearch
cli = Elasticsearch() # may need to create
from elasticsearch_dsl import connections
connections.add_connection('default',cli.client)
import elasticsearch_dsl as dsl
class Study(dsl.Document):
class Index:
name = 'sra_study-zq'
@seandavi
seandavi / main.java
Created October 1, 2019 02:08
Java string play
class Main {
public static void main(String[] args) {
String s1 = "Taylor Swift";
String s2 = "John Boyega";
String s3 = "Emma Stone";
String s4 = s1.substring(2,s1.length()-3).toLowerCase();
String s5 = s2.substring(2,s2.length()-3).toLowerCase();
String s6 = s3.substring(2,s3.length()-3).toLowerCase();
System.out.println(s1 + ">>>" + s4 + "\n" + s2 + ">>>" + s5 + "\n"+ s3 + ">>>" + s6);
}
@seandavi
seandavi / sra_urls.md
Last active August 2, 2019 14:40
SRA URLs

Build an R package

├── DESCRIPTION <<<--- This is the only file needed to have an R package!
├── NAMESPACE
├── R
│   └── hello.R
...
└── man
 └── hello.Rd
https://www.yeastgenome.org/run_seqtools?format=fasta&type=coding&genes=YAL001C&strains=S288C
# To accompany: https://seandavi.github.io/2019/05/single-cell-packages-and-dependencies-in-bioconductor-using-biocpkgtools/
library(BiocPkgTools)
library(igraph)
library(visNetwork)
bpl = biocPkgList()
bpl_sc = bpl[grepl('SingleCell', bpl$biocViews),]
dep_df = buildPkgDependencyDataFrame()
dep_graph = buildPkgDependencyIgraph(dep_df)
dep_graph_sc = inducedSubgraphByPkgs(dep_graph, bpl_sc$Package )
ledges <- data.frame(color = c("green", "lightblue", "red"),
digraph Workflow {
node [shape="box"];
subgraph cluster_0 {
SRA_XML [shape=record label="SRA XML|{Study|Sample|Experiment|Run}"]
XML_TO_JSON [label="XML to JSON"]
SRA_JSON [shape=record label="SRA JSON|{Study|Sample|Experiment|Run}"]
BIOSAMPLE_XML [label="Biosample XML"]
BIOSAMPLE_JSON [label="Biosample JSON"]

Install ingress-nginx on aws

Install nginx ingress on AWS

This installs a set of resources.

Using helm:

Assumes kubernetes cluster created and kubectl configured correctly.

kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller