Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
bkamapantula / degree_distribution.py
Last active September 29, 2015 17:27
Python degree distribution plot
We couldn’t find that file to show.
@bkamapantula
bkamapantula / script.sh
Created January 27, 2012 21:45
Embedding fonts in PDFLateX
root@------# pdffonts old_draft1.pdf
name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
MMNOLU+NimbusRomNo9L-Medi Type 1 yes yes no 4 0
QRJGLY+NimbusRomNo9L-MediItal Type 1 yes yes no 5 0
ZKJODE+NimbusRomNo9L-Regu Type 1 yes yes no 6 0
VDWPAT+CMSY8 Type 1 yes yes no 7 0
VFEFVW+NimbusRomNo9L-ReguItal Type 1 yes yes no 8 0
TXZOPV+CMMI10 Type 1 yes yes no 20 0
@bkamapantula
bkamapantula / sample.tab
Created February 24, 2012 17:32
tab file format - example
Please note that only first ten lines of the file is displayed.
1 1 Tu 1 . + CDS 1 - 1812 497
2 2 Op 1 . + CDS 2397 - 3584 482
3 2 Op 2 . + CDS 3651 - 4865 369
4 3 Tu 1 . - CDS 4812 - 4949 81
5 4 Tu 1 . + CDS 5098 - 5427 113
6 5 Tu 1 . + CDS 5702 - 7612 974
7 6 Tu 1 . - CDS 7694 - 8128 308
8 7 Tu 1 . - CDS 8702 - 8914 84
@bkamapantula
bkamapantula / sample.fasta
Created February 24, 2012 17:35
fasta file format - example
Please note that only first ten lines of the file is displayed.
>Genoma_CpI19_Refinada_v2
GTGTCGGAGGCTCCATCGACATGGAACGAGCGGTGGCAAGAAGTTACTAATGAGCTGCTG
TCACAGTCTCAGGACCCGGAAAGTGGTATTTCCATTACGCGACAGCAAAGCGCCTACCTG
CGTCTGGTTAAACCAGTTGCTTTTGTAGAGGGTATTGCCGTTTTAAGCGTTCCTCACGCC
CGAGCGAAAAAAGAGATTGAAACTACGCTGGGACCTGTTATCACAGAGGTATTGTCTCGT
AGACTAGGTCGACAATACAGTCTTGCAGTGAGCGTTCATGCTCCAGAGGAAAATCCAGAA
GTATCCTCGGCCACTCCAGATGCTGTGTCTTATTACCAGGAACAATCTGCAGTTTCTGGA
CAATACGGAGCAACTTCAGCCAATGCTGACTTCCAGAATCAACAAAGCACGATATATCGC
@bkamapantula
bkamapantula / bar_annotation.m
Created March 28, 2012 23:10
Text annotation in bar chart | Matlab
y = [100, 97.72044539209, 96.44059464582, 88.38326226012....]; % upto 20 values
for index = 1:4
text(index-0.35, y(index)+1.5, 'text');
end
% I have four sets of five-stacked columns. I have displayed annotation for four columns (one in each set).
@bkamapantula
bkamapantula / form_file_upload.html
Created May 10, 2012 19:41
Multiple file upload in PHP
<form action="multiple_file_upload.php" method="POST" enctype="multipart/form-data">
<table>
<tr><td>File 1</td> <td><input name="userfile[]" type="file" class="multi"/> </td></tr>
<tr><td>File 2</td> <td><input name="userfile[]" type="file" class="multi"/> </td></tr>
<tr><td></td> <td> <input type="submit" name="upload" value="Upload"><input type="reset"> </td> </tr>
</table>
</form>
@bkamapantula
bkamapantula / regex_variable.sh
Created June 27, 2012 20:14
Store regex in variable and use in sed | Shell script
#!/bin/bash
$stri='[0-9]*'
sed -i -e 's/ '"$stri"'....'
@bkamapantula
bkamapantula / jsInPhp.php
Created July 16, 2012 20:11
Using Javascript alert box in PHP
<?php
echo "<script language='javascript'>alert('Try to be nice, OK? Please try again :-) ')</script>";
?>
@bkamapantula
bkamapantula / httpd.conf
Created August 1, 2012 19:03
Disable list of files in a directory inside /var/www
/* Add the following lines */
<Directory "/var/www/folderName">
Options -Indexes
</Directory>
@bkamapantula
bkamapantula / performance_for_loops.py
Created October 14, 2012 22:31
Comparing nested for loop performance with itertools product and other approaches
# G is a directed graph
num_nodes = G.number_of_nodes()
t7 = time()
if ffl == 1:
for i in range(0,num_nodes):
for j in range(0,num_nodes):
for k in range(0,num_nodes):
if G.has_edge(i, j) and G.has_edge(j,k) and G.has_edge(i,k):