Skip to content

Instantly share code, notes, and snippets.

View dcalacci's full-sized avatar
🦩
wfh baby

Dan Calacci dcalacci

🦩
wfh baby
View GitHub Profile
@TomK32
TomK32 / gist:164135
Created August 7, 2009 20:04
ant dna skill-processor
# computed sample at https://gist.github.com/164138
genes = %w(A C G T)
strength = ".AG. GC.. ...A ..GC AC.. GT.. T.TC ...."
size = "CG.. .... ...C ..T. ..AC .... ...C ..A."
weight = "TC.C C... ..CG TG.C .... GC.A .GG. .AAA"
ant = ''
(0..31).each do |i|
ant += genes[rand(4)]
@TomK32
TomK32 / gist:164138
Last active November 13, 2015 05:24
ant dna
example map for
strenght: .AG. GC.. ...A ..GC | AC.. GT.. T.TC ....
size: CG.. .... ...C ..T. | ..AC .... ...C ..A.
ant 1: TTTC AAAG GGGG GAGC TGTA AGGA TTCT CCAG
ant 2: CCGC GGGC AGGT TTAC TACT TGGA TACC ACTC
Then we match each gene in strength and size against the ant unless it's a '.'
If we have match the score is increased. If we have a similarity (A<->G or C<->T)
the score is not changed and otherwise it's decreased.
@HenrikJoreteg
HenrikJoreteg / straight_include.py
Created December 15, 2010 16:06
A Django Template tag for including files that you don't want to parse as templates
"""
Straight Include template tag by @HenrikJoreteg
Django templates don't give us any way to escape template tags.
So if you ever need to include client side templates for ICanHaz.js (or anything else that
may confuse django's templating engine) You can is this little snippet.
Just use it as you would a normal {% include %} tag. It just won't process the included text.
@prellele
prellele / gist:1825744
Created February 14, 2012 10:48
Using StartSSL Certs with Nginx-Webserver

NOTE: You can check, if your config here:
http://www.sslshopper.com/ssl-checker.html

Decrypt the private key using the password you entered when you created your key:
openssl rsa -in ssl.key -out /etc/nginx/conf/ssl.key

Protect your key from prying eyes:
chmod 600 /etc/nginx/conf/ssl.key

@chengjun
chengjun / mixing_matrix.R
Created April 18, 2012 01:43 — forked from gweissman/mixing_matrix.R
Calculate mixing matrix in igraph by vertex characteristic
# calculate the mixing matrix of in igraph graph object 'mygraph', by some vertex attribute 'attrib'
# can change the default use.density=FALSE to return a matrix with raw number of edges rather than density
mixmat <- function(mygraph, attrib, use.density=TRUE) {
require(igraph)
# get unique list of characteristics of the attribute
attlist <- sort(unique(get.vertex.attribute(mygraph,attrib)))
@tobyhede
tobyhede / postsql.sql
Created May 17, 2012 03:08
PostgreSQL as JSON Document Store
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
@ngauthier
ngauthier / README.md
Created July 5, 2012 20:10
Rdio "native" in linux

I like Rdio and linux. Rdio works great in a browser except for one thing: keyboard shortcuts!!!

When coding, I like to be able to play/pause my music quickly, meaning I don't want to switch windows. I figured out a way to do this:

Google Chrome --app

First, I made a file in my ~/bin called rdio that runs:

google-chrome --app=http://rdio.com
@agnoster
agnoster / README.md
Last active July 13, 2024 19:26
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@mbostock
mbostock / .block
Last active March 2, 2024 12:15
Arc Tween
license: gpl-3.0
@brianckeegan
brianckeegan / backbone_extractor.py
Last active August 2, 2023 19:26
Given a networkx graph containing weighted edges and a threshold parameter alpha, this code will return another networkx graph with the "backbone" of the graph containing a subset of weighted edges that fall above the threshold following the method in Serrano et al. 2008.
# Serrano, Boguna, Vespigani backbone extractor
# from http://www.pnas.org/content/106/16/6483.abstract
# Thanks to Michael Conover and Qian Zhang at Indiana with help on earlier versions
# Thanks to Clay Davis for pointing out an error
import networkx as nx
import numpy as np
def extract_backbone(g, weight='weight', alpha=.05):
backbone_graph = nx.Graph()