Skip to content

Instantly share code, notes, and snippets.

@yfe404
yfe404 / main.c
Created November 25, 2013 20:42
Counting DNA Nucleotides ==> http://rosalind.info/problems/dna/
#include <stdio.h>
int main(int argc, char * argv[])
{
if(argc < 2){
fprintf(stderr, "Missing argument !\n");
return -1;
}
if(argc > 2){
@yfe404
yfe404 / main.c
Created December 30, 2013 12:58
Convert non standard format RGB32 to standard format PPM raw
/**
* \file main.c
* \brief Programme de conversion d'image rgb32 (non standard) vers PPM binaire (standard).
* \author Yann Feunteun
* \version 0.1
* \date 30 décembre 2013
*
* Ce programme convertit une image rgb32 dont le format est le suivant :
*
* 4 octets (unsigned) encodant la largeur
@yfe404
yfe404 / straceopen
Created January 2, 2014 20:00
Print the list of the files opened by a program during its execution Usage : straceopen <program [args]>
#!/bin/sh
strace $* 2>&1 | grep "open" | cut -d "(" -f 2 | cut -d ")" -f 1
@yfe404
yfe404 / syracuse.c
Created February 9, 2014 09:00
Collatz conjecture
#include <stdio.h>
#include <stdlib.h>
unsigned int syracuse(unsigned int n)
{
if(n%2 == 0)
return n/2;
else
return 3*n + 1;
@yfe404
yfe404 / dna.py
Last active August 29, 2015 14:16
A simple python program to count nuclotides in a dna strand.
"""
A string is simply an ordered collection of symbols selected from some alphabet and formed into a word; the length of a string is the number of symbols that it contains.
An example of a length 21 DNA string (whose alphabet contains the symbols 'A', 'C', 'G', and 'T') is "ATGCTTCAGAAAGGTCTTACG."
Given: A DNA string s of length at most 1000 nt.
Return: Four integers (separated by spaces) counting the respective number of times that the symbols 'A', 'C', 'G', and 'T' occur in s.
"""
@yfe404
yfe404 / rna.py
Last active August 29, 2015 14:16
A simple python program to transcript a DNA strand into a RNA one.
"""
An RNA string is a string formed from the alphabet containing 'A', 'C', 'G', and 'U'.
Given a DNA string t corresponding to a coding strand, its transcribed RNA string u is formed by replacing all occurrences of 'T' in t with 'U' in u.
Given: A DNA string t having length at most 1000 nt.
Return: The transcribed RNA string of t.
"""
@yfe404
yfe404 / main.py
Created April 12, 2015 11:06
A simple GA with - roulette-wheel sampling - population size 100- single point crossover rate 0.7- bitwise mutation rate 0.002- chromosome length 100- generations 500
__author__ = 'yafeunteun'
import pyevolve
from pyevolve import G1DList, GSimpleGA, Selectors
# This function is the evaluation function, we want
# to give high score to more one'ed chromosomes
def eval_func(chromosome):
score = 0.0
@yfe404
yfe404 / counter.py
Created July 13, 2015 09:38
Compte et affiche le nombre de lignes et de caractères dans une fichier.
#!/usr/bin/python
# Compte et affiche le nombre de lignes et de caractères dans une fichier.
# Usage : ./counter.py fichier
# author yann feunteun
# mail yannfeunteun at gmail dot com
from sys import argv
#!/bin/bash
URL=$1
echo $URL
wget --output-document="index.html" $URL
for code in `cat index.html | grep '/watch?v' | cut -d '=' -f 4 | grep -v 'title' | cut -d '"' -f 1`
@yfe404
yfe404 / features.py
Last active December 23, 2016 09:43 — forked from halfak/features.py
from revscoring.features import wikitext
from revscoring.languages import english
char_based = [
wikitext.revision.chars,
wikitext.revision.whitespace_chars,
wikitext.revision.markup_chars,
wikitext.revision.cjk_chars,
wikitext.revision.entity_chars,
wikitext.revision.url_chars,