Skip to content

Instantly share code, notes, and snippets.

View famibelle's full-sized avatar

Famibelle Médhi famibelle

View GitHub Profile
@wch
wch / server.r
Last active March 18, 2021 02:50
Shiny example with stocks
if (!require(quantmod)) {
stop("This app requires the quantmod package. To install it, run 'install.packages(\"quantmod\")'.\n")
}
# Download data for a stock if needed, and return the data
require_symbol <- function(symbol, envir = parent.frame()) {
if (is.null(envir[[symbol]])) {
envir[[symbol]] <- getSymbols(symbol, auto.assign = FALSE)
}
@cesschneider
cesschneider / gist:7689698
Last active May 21, 2022 05:23
Code snippet to test Arduino Nano led using breath effect.
/*
Android Breath v0.2
Simulates led breathing found on Android devices.
Tested with Arduino Nano ATmega328.
Cesar Schneider <cesschneider@gmail.com>
https://gist.github.com/cesschneider/7689698
*/
// Pin 13 has an LED connected on most Arduino boards.
@coppeliaMLA
coppeliaMLA / DendToForce.R
Created June 20, 2014 16:30
Converts a hclust dendrogram into a graph in JSON for input into D3
#Run hclust
hc <- hclust(dist(USArrests[1:40,]), "ave")
#Function for extracting nodes and links
extractGraph<-function(hc){
n<-length(hc$order)
m<-hc$merge
links<-data.frame(source=as.numeric(), target=as.numeric(), value=as.numeric())