Skip to content

Instantly share code, notes, and snippets.

@yfe404
yfe404 / main.py
Created October 10, 2017 13:15
robo-matplotlib-numpy-image-rgb-viz
# Import some packages from matplotlib
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
# Import the "numpy" package for working with arrays
import numpy as np
# Uncomment the next line for use in a Jupyter notebook
#%matplotlib inline
# Define the filename, read and plot the image
filename = 'sample.jpg'
@yfe404
yfe404 / main.py
Created October 10, 2017 13:12
robo-matplotlib-image-reading
# Import some packages from matplotlib
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
# Uncomment the next line for use in a Jupyter notebook
#%matplotlib inline
# Define the filename, read and plot the image
filename = 'sample.jpg'
image = mpimg.imread(filename)
plt.imshow(image)
@yfe404
yfe404 / watcher.sh
Last active November 1, 2017 10:01
Simple directory watcher - allows you to monitor recursively a directory for changes in a file. Each time a changed is made, executes the comman that you specified
#/bin/bash
##################################################################
# SIMPLE DIRECTORY WATCHER
#
# Usage:
# bash test.sh
#
# Role:
# Simple Directory Watcher allows you to monitor
@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,
#!/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 / 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
@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 / 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 / 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 / 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;