This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// This example shows how affine transformations can be combined yielding | |
// a single matrix which represent complex transformations. | |
// Feed the output into gnuplot to see the points: | |
// go build affines.go | |
// ./affines | gnuplot -p -e "plot '-' u 1:2:3 w p pt 7 palette" | |
import ( |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup python virtual environment in a given directory subtree | |
function chpwd_auto_pyvenv() { | |
local MAGIC=".zsh_pyvenv" | |
# Check if we encountered a magic previously | |
if [[ -z ${ZSH_PYVENV_PARENT+x} ]]; then | |
# Check if this directory contains a MAGIC | |
if [[ -a "$PWD/$MAGIC" ]]; then | |
echo "Activating virtual environment" | |
# Activate the environment specified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
'''So, I entered the Google Hash Code 2017 competition with a team named PiedPiper, | |
with a guy from UK and a girl from Palestine, but in the end each one of us worked | |
in her/his own. I came up with a solution using Genetic Algorithms (via DEAP). | |
I used the score function to build an algorithm that used 1-bit encodings to represent | |
the presence of a video over a certain cache server. | |
I wasted some time during the competition, so I managed to run briefly the algo on the |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Approximation of Pi using a simple, and not optimized, CUDA program | |
// Copyleft Alessandro Re | |
// | |
// GCC 6.x not supported by CUDA 8, I used compat version | |
// | |
// nvcc -std=c++11 -ccbin=gcc5 pigreco.cu -c | |
// g++5 pigreco.o -lcudart -L/usr/local/cuda/lib64 -o pigreco | |
// | |
// This code is basically equivalent to the following Python code: | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extend(old, new): | |
for p in old: | |
cand = [] | |
for n in new: | |
if n % p != 0: | |
cand.append(n) | |
if not cand: | |
return old | |
old.append(cand[0]) | |
new = cand[1:] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pandas as pd | |
import io | |
# Make up some data | |
example_csv = '''Birthday,Name,Surname | |
1643-01-04,Isaac,Newton | |
1879-03-14,Albert,Einsten | |
1942-01-08,Stephen,Hawking |