Skip to content

Instantly share code, notes, and snippets.

View jenzopr's full-sized avatar
🦊
Loading..

Dr. Jens Preußner jenzopr

🦊
Loading..
View GitHub Profile
@ramhiser
ramhiser / gist:1421185
Created December 2, 2011 01:15
Randomly subsample a matrix or data frame (Useful with the 'boot' package in R)
#' Randomly subsample a matrix or data frame.
#'
#' To randomly subsample, we are using the parametric option in the boot function
#' within the boot package. The 'parametric' option requires the specification of
#' a 'ran.gen' function to generate observations based on the original data and a list of
#' maximum likelihood estimators (MLE). We utilize this method, but instead of the
#' MLE, we instead pass the subsample_size.
#'
#' As noted in the boot documentation: Use of sim = "parametric" with a suitable ran.gen
#' allows the user to implement any types of nonparametric resampling which are not
@dorentus
dorentus / 95-lolcat
Last active February 15, 2022 12:21
dynamically generated /etc/motd using fortune, cowsay & lolcat,save it as /etc/update-motd.d/95-lolcat.Google `pam_motd` or `update-motd` for more details of dynamically generated message-of-the-day.
#!/bin/bash
# see: http://blog.tomtung.com/2009/11/cowsay-fortune
# http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed
# https://github.com/busyloop/lolcat
# https://github.com/dorentus/mruby-lolcat-bin
#
# requires `fortune`, `cowsay`,
# and ruby gem `lolcat` or its mruby version equivalent
export LANG="en_US.UTF-8"
@slowkow
slowkow / mygene.html
Last active August 29, 2015 14:07
Autocomplete genes with mygene.info and typeahead.js http://slowkow.com/2014/10/05/geneinfo-typeahead/
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="js/typeahead.bundle.min.js"></script>
@erichgess
erichgess / Cassandra Schemas
Last active June 1, 2018 13:31
Planet Cassandra Spark Blog
create KEYSPACE spark_demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
create table spark_demo.raw_files (filename text,line int, contents text, PRIMARY KEY(filename,line));
create table spark_demo.users (id int PRIMARY KEY );
create table spark_demo.movies (id int PRIMARY KEY, name text, year int);
create table spark_demo.ratings (id int PRIMARY KEY, user_id int, movie_id int, rating float );
@whophil
whophil / jupyter.service
Last active October 8, 2024 00:42 — forked from doowon/jupyter_systemd
A systemd script for running a Jupyter notebook server.
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py
@AvantiShri
AvantiShri / revcomp_weightsharing_setup.py
Last active June 1, 2018 15:05
Reverse-complement Weight Sharing Model Setup
#install keras from https://github.com/kundajelab/keras/tree/keras_1
from __future__ import print_function
import keras
import numpy as np
np.random.seed(1)
#build a sample model
model = keras.models.Sequential()
model.add(keras.layers.convolutional.RevCompConv1D(input_shape=(100,4),
nb_filter=10,
@jgilfillan
jgilfillan / cumsum_with_reset.R
Created February 3, 2017 12:44
Cumulative sum in R with reset after reaching threshold
testvector <- c(.5, .1, .2, .9, .9, .2, .5)
# group rows based on cumsum with reset
cumsum_group <- function(x, threshold) {
cumsum <- 0
group <- 1
result <- numeric()
for (i in 1:length(x)) {
cumsum <- cumsum + x[i]
@alexandari
alexandari / basset_sfc_setup.py
Created June 5, 2017 18:33
SFC Layers Example: Basset Model with SFC Layer Setup
#install keras from https://github.com/kundajelab/keras/tree/keras_1
from __future__ import print_function
import keras
import numpy as np
np.random.seed(1)
#build a model
model = keras.models.Sequential()
model.add(keras.layers.convolutional.Convolution1D(input_shape=(1000,4),
nb_filter=300,