Skip to content

Instantly share code, notes, and snippets.

View demel's full-sized avatar

De'Mel demel

View GitHub Profile
## data input (number of reads mapped to each category)
total=100
rRNA=5 # mapped to nuclear rRNA regions
mtRNA=7 # mapped to mitochondria genome
# for the rest of above, then we divide into different category, like http://www.biomedcentral.com/1741-7007/8/149 did.
intergenic=48
introns=12
exons=30
upstream=3
downstream=6
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@demel
demel / k-NN.adoc
Last active August 29, 2015 14:25

Movie Recommendations with k-Nearest Neighbors and Cosine Similarity


Introduction

The k-nearest neighbors (k-NN) algorithm is among the simplest algorithms in the data mining field. Distances / similarities are calculated between each element in the data set using some distance / similarity metric ^[1]^ that the researcher chooses (there are many distance / similarity metrics), where the distance / similarity between any two elements is calculated based on the two elements' attributes. A data element’s k-NN are the k closest data elements according to this distance / similarity.


1. A distance metric measures distance; the higher the distance the further apart the neighbors. A similarity metric measures similarity; the higher the similarity the closer the neighbors.
@demel
demel / server.R
Last active September 9, 2015 00:01 — forked from withr/server.R
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
if (USER$Logged == TRUE) {
@demel
demel / server.R
Created September 29, 2015 19:18 — forked from reinholdsson/server.R
Shiny + Redis example
library(rredis)
shinyServer(function(input, output) {
output$show <- renderText({
redisConnect()
res <- redisGet(input$key)
redisClose()
return(res)
})
## Reproducible package management for R:
install.packages("devtools")
library(devtools)
#devtools::install_github("rstudio/packrat")
# More info @ http://rstudio.github.io/packrat/
## great shiny apps
install.packages("radiant", repos = "http://vnijs.github.io/radiant_miniCRAN/")
@demel
demel / returnData.R
Created January 12, 2016 00:32 — forked from dmpe/returnData.R
returnData.R used for benchmarking RSocrata row binding
# An interface to data hosted online in Socrata data repositories
# This is the main file which uses other functions to download data from a Socrata repositories
#
# Author: Hugh J. Devlin, Ph.D et al. 2013-08-28
###############################################################################
# library("httr") # for access to the HTTP header
# library("jsonlite") # for parsing data types from Socrata
# library("mime") # for guessing mime type
# library("geojsonio") # for geospatial json
@demel
demel / README.md
Last active February 27, 2016 02:01 — forked from hrbrmstr/README.md
Immediate splunk search

basic httr idiom for splunk things tho it gets uglier with the saved searches

setup 3 variables in your .Renviron (the obvious ones from the code)

sample run:

> tmp <- search_now("host=vagrant sourcetype=syslog session closed")
> head(tmp)

X_serial X_time source sourcetype host index splunk_server

@demel
demel / jenikns_ci_on_osx.md
Created June 29, 2016 15:30 — forked from ostinelli/jenkins_ci_on_osx.md
Setup Jenkins CI on OSX.

Jenkins CI on OSX

Instructions on how to setup a secured Jenkins CI on a Mac.

Download & Install dependencies

All of these operations are done with your admin user.

Developer tools

Install the command line developer tools.

#Install R and then following packages
#repr failed to create
yum install R-*
install.packages("evaluate", dependencies = TRUE)
install.packages("base64enc", dependencies = TRUE)
install.packages("devtools", dependencies = TRUE)
install_github('IRkernel/repr')
install.packages("dplyr", dependencies = TRUE)
install.packages("caret", dependencies = TRUE)
install.packages("repr", dependencies = TRUE)