Skip to content

Instantly share code, notes, and snippets.

View cybersiddhu's full-sized avatar

Siddhartha Basu cybersiddhu

View GitHub Profile
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://d3js.org/d3.v2.js"></script>
<style>
line.arrow {
stroke: #666;

This example demonstrates how to prevent D3’s force layout from moving nodes that have been repositioned by the user. When the force layout’s drag behavior dispatches a dragstart event, the fixed property of the dragged node is set to true. This prevents the force layout from subsequently changing the position of the node (due to forces). Double-click to release a node.

Internally, the force layout uses three bits to control whether a node is fixed. The first bit can be set externally, as in this example. The second and third bits are set on mouseover and mousedown, respectively, so that nodes are fixed temporarily during dragging. Although the second and third bits are automatically cleared when dragging ends, the first bit stays true in this example, and thus nodes remain fixed after dragging.

Also note that the force layout resumes au

#!/usr/bin/env python3
"""Backs up data-only volumes to host backup directory using rdiff-backup.
First create a Docker image containing rdiff-backup (named rdiff-backup)
Dockerfile:
FROM ubuntu:precise
RUN apt-get update && apt-install -qy rdiff-backup
``docker build -rm -t rdiff-backup .``

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

// --------------------------------------------------------------------
// Dummy processing DNA code (by taking base complement)
// Sequential version
// Author: Samuel Lampa, samuel.lampa@gmail.com
// Date: 2013-06-21
// --------------------------------------------------------------------
package main
import (
@cybersiddhu
cybersiddhu / d3js_animated_bar.html
Last active December 15, 2015 06:59 — forked from benjchristensen/index.html
Animated plots using d3.js
<!doctype html>
<meta charset="utf-8">
<head>
<title> Animated bar graph with d3</title>
<style type="text/css">
div.aBar {
margin-top: 100px;
margin-left: 100px;
}
</style>
@cybersiddhu
cybersiddhu / pseudogene_issue.py
Created April 27, 2012 23:54 — forked from ypandit/pseudogene_issue.py
Solution for pseudogene issue in GFF3 for Artemis
import sys, os, string
if len(sys.argv) != 2:
print 'You seem to have forgotten to provide the input GFF3 file.'
exit()
if __name__ == "__main__":
found = False
with open(sys.argv[1], 'r') as file:
outfile = open(os.path.basename(sys.argv[1]).replace(".gff", "_corrected.gff"), 'w')
for line in file:
@cybersiddhu
cybersiddhu / .locallibrc
Created July 26, 2011 17:48 — forked from plu/.locallibrc
let local::lib + .llrc and rvm + .rvmrc live together happily next to eachother (if you load this -after- the rvm stuff!)
if [ "$(type -t cd)" == "builtin" ]; then
local func="_perl_locallib_orig_cd() { builtin cd \"\$@\"; }"
else
local func="$(declare -f cd)"
local func="_perl_locallib_orig_cd${func#cd}"
fi
eval $func
_perl_locallib_custom_cd() {
local cwd=$(pwd)
@cybersiddhu
cybersiddhu / git_fix_author
Created July 2, 2011 18:02 — forked from leif81/git_fix_author
Written to change the unix name used for a cvs commit to a pretty git name for the user. Implementation borrowed from http://lists.freedesktop.org/archives/portland/2010-October.txt author-conv-file format (same format as git-cvsimport requires):
#!/bin/bash
export $authors_file=author-conv-file
git filter-branch -f --env-filter '
get_name () {
grep "^$1=" "$authors_file" |
sed "s/^.*=\(.*\) <.*>$/\1/"
}
@cybersiddhu
cybersiddhu / myboardgame.pl
Created April 26, 2011 03:08 — forked from awwaiid/myboardgame.pl
Linux Format Perl Redone
#!/usr/bin/perl
use strict;
use Image::Magick;
# auxiliary variables
my $img_id = 0; #loop index
my @ordered_squares;
my $rotation = 180;
#Width and Height of each box, squares per side