Skip to content

Instantly share code, notes, and snippets.

View AngelBerihuete's full-sized avatar
🌳

A. Berihuete AngelBerihuete

🌳
View GitHub Profile
@AngelBerihuete
AngelBerihuete / DebianBoot.txt
Last active February 24, 2016 12:22
Debian bootable USB stick on OSX
# http://askubuntu.com/questions/192620/how-to-make-ubuntu-iso-bootable-on-a-usb-stick-with-osx
#
# Requirements:
# - pen drive formatted in FAT
# - iso file downloaded from: http://cdimage.debian.org/debian-cd/7.2.0/amd64/iso-dvd/debian-7.2.0-amd64-DVD-1.iso
# - pen drive is on /dev/disk1 -> check with "diskutil list"
hdiutil convert -format UDRW -o debianDVD.img debian-7.2.0-amd64-DVD-1.iso
diskutil unmountDisk /dev/disk1
sudo dd if=debianDVD.img of=/dev/rdisk1 bs=1m
@AngelBerihuete
AngelBerihuete / server.R
Last active August 29, 2015 14:08 — forked from yihui/server.R
library(shiny)
shinyServer(function(input, output) {
# Make three independent, repeatable copies of rnorm so that the underlying
# random values don't change
rnorm1 = repeatable(rnorm)
rnorm2 = repeatable(rnorm)
rnorm3 = repeatable(rnorm)
library(MCMCpack)
x <- 0.5
shape <- 2
scale <- 3
dinvgamma(x, shape, scale)
#from scipy.stats import invgamma
@AngelBerihuete
AngelBerihuete / rgl_installation_R.txt
Created February 18, 2016 09:21
Problems with glu.h in the installation of rgl package under Linux OpenSuse distribution
When yo try to install rgl in R you have an error about glu.h
%%%%%%%%%%%%%%%
checking GL/glu.h usability... no
checking GL/glu.h presence... no
checking for GL/glu.h... no
configure: error: missing required header GL/glu.h
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/angel/R/x86_64-suse-linux-gnu-library/3.2/rgl’
Warning in install.packages :
#Load library mass and set seed
library(MASS)
set.seed(100)
# We are going to use 3 random variables
m <- 3
# Number of samples to be drawn
n <- 2000
@AngelBerihuete
AngelBerihuete / query_argonaut.pro
Created May 2, 2016 16:30 — forked from gregreen/query_argonaut.pro
Query Argonaut Server (for 3D Dust Map)
;+
; NAME:
; query_argonaut
;
; PURPOSE:
; Query the Argonaut server for 3D dust information or SFD
;
; CALLING SEQUENCE:
; qresult = query_argonaut(/struct, /debug, _extra=coords)
;
# Multiple plot function
#
# ggplot objects can be passed in ..., or to plotlist (as a list of ggplot objects)
# - cols: Number of columns in layout
# - layout: A matrix specifying the layout. If present, 'cols' is ignored.
#
# If the layout is something like matrix(c(1,2,3,3), nrow=2, byrow=TRUE),
# then plot 1 will go in the upper left, 2 will go in the upper right, and
# 3 will go all the way across the bottom.
#
@AngelBerihuete
AngelBerihuete / tab_trans.py
Created June 1, 2016 12:25 — forked from PBarmby/tab_trans.py
Transpose tables in astropy
import numpy as np
from astropy.table import Table, Column
def transpose_table(tab_before, id_col_name='ID'):
'''Returns a copy of tab_before (an astropy.Table) with rows and columns interchanged
id_col_name: name for optional ID column corresponding to
the column names of tab_before'''
# contents of the first column of the old table provide column names for the new table
# TBD: check for duplicates in new_colnames & resolve
new_colnames=tuple(tab_before[tab_before.colnames[0]])
@AngelBerihuete
AngelBerihuete / mvnormal-extension.py
Created July 12, 2016 10:52 — forked from brandonwillard/mvnormal-extension.py
Somewhat fixed MvNormal implementation
from scipy import stats
from theano.tensor.nlinalg import det, matrix_inverse, trace, eigh
from pymc3 import transforms
from pymc3.distributions.distribution import Continuous, Discrete, draw_values, generate_samples
from pymc3.distributions.special import gammaln, multigammaln
from pymc3.distributions.dist_math import bound, logpow, factln
class MvNormal(Continuous):
r"""
Existe un problema cuando se instala Rmath en julia (OpenSUSE)
julia> Pkg.build("Rmath")
INFO: Building Rmath
INFO: Attempting to Create directory /home/angel/.julia/v0.5/Rmath/deps/downloads
INFO: Directory /home/angel/.julia/v0.5/Rmath/deps/downloads already created
INFO: Downloading file https://github.com/JuliaLang/Rmath-julia/archive/v0.1.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (77) error setting certificate verify locations: