Skip to content

Instantly share code, notes, and snippets.

Paul R Alexander palexander

Block or report user

Report or block palexander

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View install_spark_centos7.sh
#!/bin/bash
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz
tar xvf scala-2.11.7.tgz
sudo mv scala-2.11.7 /usr/lib
sudo ln -s /usr/lib/scala-2.11.7 /usr/lib/scala
@palexander
palexander / benchmark_dbs_vs_marshal.rb
Created Apr 28, 2015
Benchmark Ruby storage mechanisms
View benchmark_dbs_vs_marshal.rb
def time_code(name, &block)
t1 = Time.now
yield
puts "#{name}: #{(Time.now - t1).to_f.round(2)}s"
end
def time_code_aggregate(name, &block)
unless @tc_at_exit
at_exit do
@tc_timers.each do |name, time|
@palexander
palexander / expand_labels.go
Created Sep 18, 2014
Find RXNORM ingredients and brand names then expand the labels across CUI mappings to NCI and SNOMEDCT_US
View expand_labels.go
package main
import "github.com/palexander/goumls"
import "log"
func main() {
// Filters for queries
rxnorm := toEntries("RXNORM")
rxnormTTY := toEntries("IN", "BN")
expandedTTY := toEntries("AB", "PT", "SY")
@palexander
palexander / 0_reuse_code.js
Created Jun 3, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@palexander
palexander / header_data.txt
Last active Aug 29, 2015
Example format for NCBO multipart/mixed ontology submission with file
View header_data.txt
Content-Type: multipart/mixed; boundary=OntologiesAPIMultipartPost; type=application/json; start=json
Content-Length: 328853
@palexander
palexander / ruby_optional_arguments_benchmark.rb
Last active Jan 4, 2016
Benchmark to compare hash and keyword arguments in method invocations
View ruby_optional_arguments_benchmark.rb
require 'benchmark'
COUNT = 10_000_000
NAME = "Test Name"
EMAIL = "test@example.org"
class Person
attr_accessor :name, :email
def set_with_hash(options = {})
@palexander
palexander / ruby_data_object_comparison.rb
Created Jan 24, 2014
Benchmark to compare hash, OpenStruct, struct, and classes in Ruby
View ruby_data_object_comparison.rb
require 'ostruct'
require 'benchmark'
COUNT = 10_000_000
NAME = "Test Name"
EMAIL = "test@example.org"
class Person
attr_accessor :name, :email
end
View virtual_to_acronym_mapping.csv
1000 MA
1001 GRO-CPGA
1005 BTO
1006 CL
1007 CHEBI
1008 DDANAT
1009 DOID
1010 EMAP
1011 IEV
1012 ECO
View docker_parallel_rake_test_advanced.rb
namespace :docker do
desc "Run tasks in parallel using docker"
task :test do
forks = 4
begin
# Start docker containers (serially, docker seems to have problems with concurrency)
ports = {}
forks.times do |i|
# Start redis and get the mapped port
`docker run -d -p 6379 -name redis#{i} yourdockeruser/redis`
View docker_parallel_rake_tests_try_catch.diff
@@ -27,6 +27,7 @@ namespace :docker do
pids = []
forks.times do |i|
pids << fork do
+ begin
##
# Configure your environment
# You'll want to do something here to make the environment
@@ -49,7 +50,9 @@ namespace :docker do
You can’t perform that action at this time.