Skip to content

Instantly share code, notes, and snippets.

View alessandro-gentilini's full-sized avatar

Alessandro Gentilini alessandro-gentilini

View GitHub Profile
https://stackoverflow.com/a/34301262
find . -name '*.TXT' -exec grep -H 'foo' {} ';'
@alessandro-gentilini
alessandro-gentilini / update-google-chrome.txt
Last active March 31, 2016 18:08
update google chrome
See http://superuser.com/a/561007/71255
sudo apt-get --only-upgrade install google-chrome-stable
sudo pkill -15 google-chrome
sudo pkill -15 chrome
@alessandro-gentilini
alessandro-gentilini / so_33423107.m
Last active December 29, 2015 10:44
A tentative answer for stackoverflow.com/questions/33423107 written in Octave.
# https://stackoverflow.com/questions/33423107/how-to-find-2-lines-given-only-points
clear;
pkg load image
img = rgb2gray(imread("VGUM6.png"));
img = img < 128;
rp = regionprops(bwlabel(img));
X = zeros(1,size(rp)(1));
Y = zeros(1,size(rp)(1));
@alessandro-gentilini
alessandro-gentilini / dsp_1637.m
Last active December 29, 2015 10:30
A tentative answer for dsp.stackexchange.com/questions/1637 written in Octave.
% http://dsp.stackexchange.com/questions/1637/what-does-frequency-domain-denote-in-case-of-images
%b=zeros(10,200);
%w=ones(10,200);
%bw=[b;w];
%img=repmat(bw,10,1);
%imshow(img);
%F = fft2(img);
%figure
%imshow(log(abs(fftshift(F)) + 1), [])
@alessandro-gentilini
alessandro-gentilini / probability_of_pregnancy.R
Last active December 12, 2015 19:42 — forked from rasmusab/probability_of_pregnancy.R
A script that implements a Bayesian model calculating the probability that a couple is fertile and is going to be pregnant.
# Per i dettagli vedi http://www.sumsar.net/blog/2015/11/a-bayesian-model-to-calculate-whether-my-wife-is-pregnant/
# A Bayesian model that calculates a probability that a couple is fertile
# and pregnant. Please use this for fun only, not for any serious purpose
# like *actually* trying to figure out whether you are pregnant.
# Enter your own period onsets here:
period_onset <- as.Date(c("2014-07-02", "2014-08-02", "2014-08-29", "2014-09-25",
"2014-10-24", "2014-11-20", "2014-12-22", "2015-01-19"))
# If you have no dates you can just set days_between_periods to c() instead like:
@alessandro-gentilini
alessandro-gentilini / R.sublime-build
Created December 12, 2015 14:06 — forked from banrahan/R.sublime-build
R build system for Sublime Text 3
{
"cmd": ["Rscript", "$file"],
"selector": "source.r"
}
@alessandro-gentilini
alessandro-gentilini / gist:ed5708903cca78930236
Last active August 29, 2015 14:16 — forked from Kerrick/gist:2716568
Installa Sublime Text in Debian
# Download Sublime Text 2 from http://www.sublimetext.com/2
# If you aren't root, sudo su
tar -xvjf Sublime\ Text\ 2*.tar.bz2
mv Sublime\ Text\ 2/ /opt/sublime-text-2/
ln -s /opt/sublime-text-2 /usr/local/sublime-text-2
ln -s /usr/local/sublime-text-2/sublime_text /usr/local/bin/sublime_text
rm Sublime\ Text\ 2*.tar.bz2
# Sublime Text 2 can now be run as normal user with command "sublime_text"