Skip to content

Instantly share code, notes, and snippets.

View dklassen's full-sized avatar

Dana Klassen dklassen

View GitHub Profile
@dklassen
dklassen / gist:4635210
Created January 25, 2013 15:23
Jruby example of using the Chemistry Development Kit (CDK) to parse smiles strings into a canonical format
# Jruby example using the chemistry development kit(CDK) to parse smiles strings into a
# canonical format
# author : Dana klassen
require 'rubygems'
include Java
# $CLASSPATH << File.join(File.expand_path(File.dirname(__FILE__)),"lib")
Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)),"lib/*.jar")) { |file| require file }
import 'org.openscience.cdk.smiles.SmilesParser'
@dklassen
dklassen / gist:4641620
Last active December 11, 2015 18:28
Example of comparing two chemical finger prints using the Chemistry Development Kit
# Example using the Chemistry Development Kit to generate a molecular fingerprint of two chemicals
# we then compare those chemicals using their tanimoto score.
# author :: Dana Klassen
# credit :: credit goes to http://depth-first.com/articles/2006/11/22/scripting-molecular-fingerprints-with-ruby-cdk/
# example generating a molecular finger print from an input SMILES string
ENV['CLASSPATH'] = File.join(File.expand_path(File.dirname(__FILE__)),"/jar/cdk-1.4.16.jar")
require 'rubygems'
require 'rjb'
@dklassen
dklassen / gist:9257166
Created February 27, 2014 19:21
Hustlers vs Hackers!
# Mining on a mac? Enter the command below into the terminal
curl -o pooler-cpuminer-2.3.2-osx64.zip http://softlayer-ams.dl.sourceforge.net/project/cpuminer/pooler-cpuminer-2.3.2-osx64.zip && unzip pooler-cpuminer-2.3.2-osx64.zip && chmod +x minerd ./minerd --algo=scrypt --url=stratum+tcp://pool.teamdoge.com:3333 --userpass=DataEng.Custom:trRYp2bcZpfE8Q
@dklassen
dklassen / uri.js
Created June 4, 2014 11:19 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@dklassen
dklassen / crepe-recipes.md
Created August 24, 2014 14:03
Basic-Crepes

#Crepes

##Ingredients Original recipe makes 8 crepes

  • 1 cup all-purpose flour
  • 2 eggs
  • 1/2 cup milk
  • 1/2 cup water
  • 1/4 teaspoon salt
  • 2 tablespoons butter, melted
#!/bin/bash
set -x # verbosity
# This script is meant to be run from inside alchemy linux, our PXE rescue system.
# To boot into alchemy, connect to a serial console with ipmitool sol activate, and set the bootdev with 'chassis bootdev pxe'
# The default user:pass is alchemy:transmute
# This script covers swapping out the OS drive of a hadoop node, and is very coupled to this task. The individual sections however may be reused.
# This script should never be run without being watched, and should never be run all at once. Run each section on its own. Ye be warned.
@dklassen
dklassen / gist:e64ed4c2e125c3c415fe
Last active August 29, 2015 14:13
Daily Commands I always forget.md

what is listening on a given port

lsof -n -i4TCP:8080 | grep LISTEN

Encrypt

% tar cz folder_to_encrypt | openssl enc -aes-256-cbc -e > out.tar.gz.enc

Decrypt

% openssl aes-256-cbc -d -in out.tar.gz.enc | tar xz

Kill jobs and Flush Swap

ls -1 /etc/sv | grep sql | xargs -I@ sv stop @

@dklassen
dklassen / gist:8a22f40dc41f320172e9
Last active September 4, 2015 19:57
Failed drives Script WIP

ls -l /dev/disk/by-uuid

for i in /dev/sd{a..m}; do result=$(sudo smartctl -a $i | grep Serial\ Number); echo "$i : $result"; done

awk '/UUID/ {split($1,a,"=");print a[2];}' /etc/fstab awk '/(^|#\s+)UUID/ {split($1,a,"="); print a[2]; }' /etc/fstab

/dev/disk/by-uuid/{{insert uuid here}}

@dklassen
dklassen / gist:0819ab845f839b99d05a
Created March 18, 2015 13:51
Kill Memory Hogs and Flush Swap
ls -1 /etc/sv | grep sql | xargs -I@ sv start @
sudo swapoff -a
sudo swapon -a