Skip to content

Instantly share code, notes, and snippets.

View xrobin's full-sized avatar

Xavier Robin xrobin

View GitHub Profile
@briatte
briatte / hmisc.r
Created October 19, 2013 09:36
weighted quantile functions that actually do NOT return exactly the same output: reldist often returns the same thing for any value of its quantile argument
> Hmisc::wtd.quantile
function (x, weights = NULL, probs = c(0, 0.25, 0.5, 0.75, 1),
type = c("quantile", "(i-1)/(n-1)", "i/(n+1)", "i/n"), normwt = FALSE,
na.rm = TRUE)
{
if (!length(weights))
return(quantile(x, probs = probs, na.rm = na.rm))
type <- match.arg(type)
if (any(probs < 0 | probs > 1))
stop("Probabilities must be between 0 and 1 inclusive")
@jumanjiman
jumanjiman / flexlm
Created October 18, 2011 21:56
init script for flexlm
#!/bin/bash
#
# /etc/rc.d/init.d/flexlm
#
# Manage the Intel license server
#
# chkconfig: 2345 90 10
# description: Start or stop the Intel flex license manager
# There are two daemons: the master and the vendor.
@kamermans
kamermans / fail2ban-allstatus.sh
Created July 11, 2011 17:06
Show status of all fail2ban jails at once
#!/bin/bash
JAILS=`fail2ban-client status | grep "Jail list" | sed -E 's/^[^:]+:[ \t]+//' | sed 's/,//g'`
for JAIL in $JAILS
do
fail2ban-client status $JAIL
done
@brendano
brendano / gist:39760
Created December 24, 2008 20:11
load the MNIST data set in R
# Load the MNIST digit recognition dataset into R
# http://yann.lecun.com/exdb/mnist/
# assume you have all 4 files and gunzip'd them
# creates train$n, train$x, train$y and test$n, test$x, test$y
# e.g. train$x is a 60000 x 784 matrix, each row is one digit (28x28)
# call: show_digit(train$x[5,]) to see a digit.
# brendan o'connor - gist.github.com/39760 - anyall.org
load_mnist <- function() {
load_image_file <- function(filename) {