Skip to content

Instantly share code, notes, and snippets.

View cybersiddhu's full-sized avatar

Siddhartha Basu cybersiddhu

View GitHub Profile
@cybersiddhu
cybersiddhu / dbic_cache_test.pl
Created January 31, 2013 22:56
Creating a cache for gene accession
package CacheTest;
use namespace::autoclean;
use Moose;
use DBIx::Class::ResultClass::HashRefInflator;
use feature qw/say/;
has 'schema' => ( is => 'rw', isa => 'Bio::Chado::Schema' );
has '_feature_stack' => (
is => 'rw',
@cybersiddhu
cybersiddhu / index_gene.pl
Created February 25, 2013 00:53
Index gene names and synonyms with Elasticsearch
#!/usr/bin/perl -w
use strict;
use Pod::Usage;
use Getopt::Long;
use ElasticSearch;
use Bio::Chado::Schema;
use Try::Tiny;
use MyOracleSynonym;
@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>
// --------------------------------------------------------------------
// Dummy processing DNA code (by taking base complement)
// Sequential version
// Author: Samuel Lampa, [email protected]
// Date: 2013-06-21
// --------------------------------------------------------------------
package main
import (
@cybersiddhu
cybersiddhu / dietfs
Last active December 20, 2015 07:08
Script for creating dietfs docker container
#!/bin/sh
[ -f rootfs.tar ] || {
echo "Hmm this should run in the directory of rootfs.tar"
exit 1
}
rm -rf extra
mkdir extra extra/etc extra/sbin extra/lib extra/lib64
touch extra/etc/resolv.conf
touch extra/sbin/init
# Uncomment this if you want to include docker in the image, for testing purposes
@cybersiddhu
cybersiddhu / init-pglite
Last active December 20, 2015 07:09
Dockerfile for pglite
#!/bin/sh
set -e
mkdir /usr/share/zoneinfo /data
chown default /data
head -c 16 /dev/urandom | sha1sum | cut -c1-10 > /pwfile
echo "PG_PASSWORD=$(cat /pwfile)"
su default -s /usr/bin/initdb -- --pgdata=/data --pwfile=/pwfile --username=postgres --auth=trust >/dev/null
echo host all all 0.0.0.0 0.0.0.0 md5 >> /data/pg_hba.conf
exec su default -s /usr/bin/postgres -- -D /data -c 'listen_addresses=*'

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

@cybersiddhu
cybersiddhu / gff3tochado_update.pl
Created January 11, 2014 23:10
bulk updating of feature locations
use strict;
use autodie qw/open close/;
use DBI;
use Getopt::Long;
use Bio::GFF3::LowLevel qw/gff3_parse_feature/;
my ( $dsn, $user, $pass );
GetOptions(
'dsn=s' => \$dsn,
'u|user=s' => \$user,
panic: reflect: call of reflect.Value.FieldByName on string Value
goroutine 1 [running]:
runtime.panic(0x709360, 0xc210072540)
/custom/golang/go/src/pkg/runtime/panic.c:266 +0xb6
reflect.flag.mustBe(0x186, 0x19)
/custom/golang/go/src/pkg/reflect/value.go:241 +0x8c
reflect.Value.FieldByName(0x6b12e0, 0xc210073df0, 0x186, 0xc210000c90, 0x6, ...)
/custom/golang/go/src/pkg/reflect/value.go:841 +0x40
github.com/jinzhu/gorm.(*Scope).Fields(0xc210078600, 0xc21008a1e0, 0x7f92cbfce130, 0x7f92cbfce000)
#!/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 .``