Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🔬
Researching 'em microbes...

Christian Diener cdiener

👨‍🔬
Researching 'em microbes...
View GitHub Profile
@cdiener
cdiener / install_python.md
Last active Jan 20, 2018
Como instalar Python y Jupyter
View install_python.md

Como instalar Python y Jupyter

Para las siguientes clases vamos a usar Python como nuestro lenguaje de programación preferido. En particular, vamos a usar la versión 3 de Python y las libretas de Jupyter. Para ya tener una instalación funcional en la clase, aquí hay unas pistas para la instalación. Para la instalación en Windows y Mac vamos a usar la versión de Anaconda mientras que para Linux usamos la versión nativa de Python.

Para Windows

@cdiener
cdiener / overload.R
Last active Aug 23, 2019
R operator overloading
View overload.R
a = "bla"
b = "so on"
class(a) = append("my_class", class(a))
'+.my_class' = function(x,y) paste(x,y,sep=" and ")
print(a+b)
View keybase.md

Keybase proof

I hereby claim:

  • I am cdiener on github.
  • I am cdiener (https://keybase.io/cdiener) on keybase.
  • I have a public key ASBZVRZQ9U_qJu_jYWdikE66fJ9Vbl6g-YWN92NVOcc8kgo

To claim this, I am signing this object:

@cdiener
cdiener / asciinator.py
Last active May 20, 2020
Convert image to ascii art
View asciinator.py
import sys; from PIL import Image; import numpy as np
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@'))
if len(sys.argv) != 4: print( 'Usage: ./asciinator.py image scale factor' ); sys.exit()
f, SC, GCF, WCF = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]), 7/4
img = Image.open(f)
S = ( round(img.size[0]*SC*WCF), round(img.size[1]*SC) )
img = np.sum( np.asarray( img.resize(S) ), axis=2)
@cdiener
cdiener / asciinator.py
Created Apr 13, 2014
asciinator.py now with documentation
View asciinator.py
# This line imports the modules we will need. The first is the sys module used
# to read the command line arguments. Second the Python Imaging Library to read
# the image and third numpy, a linear algebra/vector/matrix module.
import sys; from PIL import Image; import numpy as np
# This is a list of characters from low to high "blackness" in order to map the
# intensities of the image to ascii characters
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@'))
# Check whether all necessary command line arguments were given, if not exit and show a
@cdiener
cdiener / setup_qiime2.py
Last active Oct 21, 2020
Set up Qiime 2 on Google colab
View setup_qiime2.py
"""Set up Qiime 2 on Google colab.
Do not use this on o local machine, especially not as an admin!
"""
import os
import sys
from subprocess import Popen, PIPE
r = Popen(["pip", "install", "rich"])
You can’t perform that action at this time.