Skip to content

Instantly share code, notes, and snippets.

View celestialphineas's full-sized avatar
🐢
Slowly working on hanzi stuff

Celestial Phineas celestialphineas

🐢
Slowly working on hanzi stuff
View GitHub Profile
@celestialphineas
celestialphineas / dnf.py
Created March 19, 2019 18:04
A program for counting dinucleotide frequency for each contig in a .FASTA file
#!/usr/bin/python
import sys
from Bio import SeqIO
from itertools import groupby, product
def canonical(x):
rules = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
paired = ''.join(map(lambda x: rules[x], list(x[::-1])))
return paired if paired < x else x
@celestialphineas
celestialphineas / regex.txt
Created March 18, 2019 18:40
Regular expression collections
# Parsing CSS
\s*([^{]+)\s*\{\s*([^}]*?)\s*}
@celestialphineas
celestialphineas / spades.log
Created February 11, 2019 14:11
SPAdes issued log
Command line: /cm/shared/c3ddb/SPAdes/3.6.2/bin/spades.py --careful --sc -t 8 -m 64 -1 /scratch/users/yehang/mock/28625_R1_paired.fastq -2 /scratch/users/yehang/mock/28625_R2_paired.fastq -o /scratch/users/yehang/individual/results/28625
System information:
SPAdes version: 3.6.2
Python version: 2.6.6
OS: Linux-2.6.32-431.el6.x86_64-x86_64-with-redhat-6.6-Santiago
Output dir: /scratch/users/yehang/individual/results/28625
Mode: read error correction and assembling
Debug mode is turned OFF
@celestialphineas
celestialphineas / params.txt
Created February 11, 2019 14:09
SPAdes issued params
Command line: /cm/shared/c3ddb/SPAdes/3.6.2/bin/spades.py --careful --sc -t 8 -m 64 -1 /scratch/users/yehang/mock/28625_R1_paired.fastq -2 /scratch/users/yehang/mock/28625_R2_paired.fastq -o /scratch/users/yehang/individual/results/28625
System information:
SPAdes version: 3.6.2
Python version: 2.6.6
OS: Linux-2.6.32-431.el6.x86_64-x86_64-with-redhat-6.6-Santiago
Output dir: /scratch/users/yehang/individual/results/28625
Mode: read error correction and assembling
Debug mode is turned OFF
@celestialphineas
celestialphineas / heapmap.js
Created January 3, 2019 08:57
Draw a heat map using Echarts
// http://echarts.baidu.com/examples/editor.html?c=heatmap-cartesian
var hours = ['12a', '1a', '2a', '3a', '4a', '5a', '6a',
'7a', '8a', '9a','10a','11a',
'12p', '1p', '2p', '3p', '4p', '5p',
'6p', '7p', '8p', '9p', '10p', '11p'];
var days = ['Saturday', 'Friday', 'Thursday',
'Wednesday', 'Tuesday', 'Monday', 'Sunday'];
var data = [[0,0,5],[0,1,1],[0,2,0],[0,3,0],[0,4,0],[0,5,0],[0,6,0],[0,7,0],[0,8,0],[0,9,0],[0,10,0],[0,11,2],[0,12,4],[0,13,1],[0,14,1],[0,15,3],[0,16,4],[0,17,6],[0,18,4],[0,19,4],[0,20,3],[0,21,3],[0,22,2],[0,23,5],[1,0,7],[1,1,0],[1,2,0],[1,3,0],[1,4,0],[1,5,0],[1,6,0],[1,7,0],[1,8,0],[1,9,0],[1,10,5],[1,11,2],[1,12,2],[1,13,6],[1,14,9],[1,15,11],[1,16,6],[1,17,7],[1,18,8],[1,19,12],[1,20,5],[1,21,5],[1,22,7],[1,23,2],[2,0,1],[2,1,1],[2,2,0],[2,3,0],[2,4,0],[2,5,0],[2,6,0],[2,7,0],[2,8,0],[2,9,0],[2,10,3],[2,11,2],[2,12,1],[2,13,9],[2,14,8],[2,15,10],[2,16,6],[2,17,5],[2,18,5],[2,19,5],[2,20,7],[2,21,4],[2,22,2],[2,23,4],[3,0,7],[3,1,3],[3,2,0],[3,3,0],[3,
@celestialphineas
celestialphineas / spectrum.wl
Created November 28, 2018 10:55
Draw an absorption spectrum
(* https://mathematica.stackexchange.com/questions/145594/how-can-i-plot-visible-spectrum *)
data = {{380., 0.765}, {380.5, 0.774}, {381., 0.767}, {381.5, 0.76}, {382.,
0.747}, {382.5, 0.698}, {383., 0.7}, {383.5, 0.654}, {384.,
0.646}, {384.5, 0.639}, {385., 0.646}, {385.5, 0.597}, {386.,
0.598}, {386.5, 0.609}, {387., 0.557}, {387.5, 0.552}, {388.,
0.547}, {388.5, 0.566}, {389., 0.588}, {389.5, 0.619}, {390.,
0.601}, {390.5, 0.599}, {391., 0.628}, {391.5, 0.645}, {392.,
0.713}, {392.5, 0.752}, {393., 0.697}, {393.5, 0.7}, {394.,
0.731}, {394.5, 0.742}, {395., 0.759}, {395.5, 0.804}, {396.,
0.753}, {396.5, 0.78}, {397., 0.795}, {397.5, 0.773}, {398.,
@celestialphineas
celestialphineas / cal.y
Created March 27, 2018 07:19
Yacc program for generating a simple infix calculator
%{
/* Example of a Yacc calculator */
#define YYSTYPE double
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
%}
%token OPERAND
%left '+' '-'
@celestialphineas
celestialphineas / wc.l
Created March 12, 2018 15:05
Lex program for generating a lexer implementing word counting.
%{
/* Example of Lex program to count words in a file. */
#include <stdio.h>
#include <stdlib.h>
/* Numbers of characters, words and lines */
int nchar = 0;
int nword = 0;
int nline = 0;
%}
%%
@celestialphineas
celestialphineas / car.pov
Created January 10, 2018 06:49
Rendering a car with POV-Ray
This file has been truncated, but you can view the full file.
#include "colors.inc"
#include "glass.inc"
background { color rgb <0.5, 0.5, 0.5> }
global_settings {
assumed_gamma 2.5
max_trace_level 25
radiosity{
pretrace_start 0.04
#include <stdio.h>
void Series_Sum(double sum[]);
int main(void)
{
int i;
double x, sum[3001];
Series_Sum(sum);