Skip to content

Instantly share code, notes, and snippets.

View alexkalderimis's full-sized avatar

Alex Kalderimis alexkalderimis

  • StackBlitz
  • Maine, USA
  • 09:12 (UTC -04:00)
View GitHub Profile
@alexkalderimis
alexkalderimis / GenesInRegions.py
Created November 1, 2011 17:15
Find regions with most genes
#!/usr/bin/python
# From a file containing a set of intervals identified as
# regulating gene expression, identify display the 3 regions
# with the highest number of genes
from intermine.webservice import Service
from interminebio import RegionQuery
intervals = open("expression_regions.bed").readlines()
@alexkalderimis
alexkalderimis / module.coffee
Created March 13, 2012 12:49
Nice namespace API for coffeescript
root = exports ? this
unless root.console
root.console =
log: ->
debug: ->
error: ->
namespace = (path, code = ->) ->
parts = path.split "."
@alexkalderimis
alexkalderimis / sample-wls-response
Created April 4, 2013 09:33
State of the wls-response prior to verification
{ msg: '',
id: '1365039030-16998-4',
principal: 'test0001',
auth: 'pwd',
params: '',
kid: '901',
ver: 2,
url: 'http://localhost:3001/',
status: 200,
issuedAt: {},
@alexkalderimis
alexkalderimis / can-we-verify.rb
Created April 10, 2013 21:22
Verifying signature in ruby
require 'base64'
require 'openssl'
DEFAULT_PUBLIC_KEY_FILE = 'keys/demo-server/pubkey901'
RESP = '2!200!!20130404T013030Z!1365039030-16998-4!http%3A%2F%2Flocalhost%3A3001%2F!test0001!pwd!!36000!'
RAW_SIG = 'EJhXHSEuaj2T3U-f-8OMCIb2DSkFvx7jRUFY5EgGlLiyKlWcR7s1DI..FJLKGc6Otb9rKFK-haF7NvyzMMmOkbx1iKZSgUXW5B420-dW.7TPOB187xcHzQezPSw7rHxrq2byp-pRkT7G9TDWDrqAMblasSsN3s8Nanifp1gOcxA_'
sig = RAW_SIG.tr('-._','+/=')
key = IO.read( DEFAULT_PUBLIC_KEY_FILE ).to_s
@alexkalderimis
alexkalderimis / can-we-verify.ls
Created April 10, 2013 21:24
Testing verification in ls
require! fs
require! crypto
SIG_RE = /(_|\.|-)/g
re-sig = [[\- \+], [\. \/], [\_ \=]] |> listToObj |> objToFunc
sample-response = '2!200!!20130404T013030Z!1365039030-16998-4!http%3A%2F%2Flocalhost%3A3001%2F!test0001!pwd!!36000!'
raw-sig = 'EJhXHSEuaj2T3U-f-8OMCIb2DSkFvx7jRUFY5EgGlLiyKlWcR7s1DI..FJLKGc6Otb9rKFK-haF7NvyzMMmOkbx1iKZSgUXW5B420-dW.7TPOB187xcHzQezPSw7rHxrq2byp-pRkT7G9TDWDrqAMblasSsN3s8Nanifp1gOcxA_'
sig = raw-sig.replace SIG_RE, re-sig
@alexkalderimis
alexkalderimis / query-to-list.html
Last active December 16, 2015 10:38
Adding a new query action.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" type="text/css" href="http://cdn.intermine.org/js/intermine/im-tables/1.2.0/imtables.css">
<script
charset="UTF-8"
(ns myapp.authenticate.oauth
"OAuth authentication"
(:require
[cheshire.core :as json]
[clj-http.client :as http]
[clojure.string :as string]
[clojure.tools.logging :as logging])
(:use
[oauthentic.core :only [build-authorization-url fetch-token]]
[ring.util.response :only [redirect]]
@alexkalderimis
alexkalderimis / gist:202a8f50a47f75995ea8
Created June 27, 2014 18:35
Minimal generic data source
<?xml version="1.0"?>
<!--
If the value of 'URL_method' is 'get', the request will consist of the value of 'URL' coming back in
the initial response. If value of 'URL_method' is 'post', any additional params coming back in the
initial response ( in addition to 'URL' ) will be encoded and appended to URL and a post will be performed.
-->
<tool name="Generic Data Source" id="data_source" tool_type="data_source" >
<description>generic data source</description>
<command interpreter="python">data_source.py $output $__app__.config.output_size_limit</command>
<inputs check_values="false" >
@alexkalderimis
alexkalderimis / index.html
Last active October 26, 2015 14:27
Custom mode RefME widget example
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<title>RefME Cite Button</title>
<script src="https://widget.refme.com/scripts/refme-cite.js"></script>
</head>
<body>
<section>
<div class="col">
<div id="citation-button"></div>
@alexkalderimis
alexkalderimis / index.html
Last active September 16, 2015 10:40
Auto load mode usage example for the RefME widget
<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# books: http://ogp.me/ns/books#">
<meta name="og:type" content="book" />
<meta name="og:title" content="Snow Crash" />
<meta name="og:image" content="http://en.wikipedia.org/wiki/File:Snowcrash.jpg" />
<meta name="og:description" content="In reality, Hiro Protagonist delivers pizza for Uncle Enzo&#x2019;s CosoNostra Pizza Inc., but in the Metaverse he&#x2019;s a warrior prince. Plunging headlong into the enigma of a new computer virus that&#x2019;s striking down hackers everywhere, he races along the neon-lit streets on a search-and-destroy mission for the shadowy virtual villain threatening to bring about infocalypse. Snow Crash is a mind-altering romp through a future America so bizarre, so outrageous&#x2026;you&#x2019;ll recognize it immediately." />
<meta property="books:isbn" content="0553380958" />
<meta name="article:published_time" content="June 1992"/>
<