Skip to content

Instantly share code, notes, and snippets.

View robsalasco's full-sized avatar
☀️
Enjoying life

Roberto Salas robsalasco

☀️
Enjoying life
View GitHub Profile
@larsch
larsch / install-arch-linux-rpi-zero-w.sh
Created July 6, 2017 06:05
Install Arch Linux ARM for Raspberry Pi Zero W on SD Card (with commands to configure WiFi before first boot).
#!/bin/sh -exu
dev=$1
cd $(mktemp -d)
function umountboot {
umount boot || true
umount root || true
}
# RPi1/Zero (armv6h):
@calligross
calligross / app.R
Last active August 23, 2023 17:22
Shiny Cookie Based Authentication Example, please visit https://calligross.de/post/using-cookie-based-authentication-with-shiny/ for more information.
library(shiny)
library(shinyjs)
if (!dir.exists('www/')) {
dir.create('www')
}
download.file(
url = 'https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js',
destfile = 'www/js.cookie.js'
@tomsing1
tomsing1 / luigi_first_steps.md
Last active April 11, 2025 18:01
First steps with the Luigi workflow manager

First steps with the Luigi workflow manager

As an introduction into Luigi, I am following this tutorial with some modifications, e.g. installation using conda.

The problems and solutions described in the examples below have led to the development of sciluigi,

@pvictor
pvictor / selectize-remove_button.R
Last active May 30, 2022 18:07
Add a remove button to each item of a selectize input
library(shiny)
ui <- fluidPage(
selectizeInput(
inputId = "select",
label = "Select",
choices = NULL,
multiple = TRUE,
options = list(
plugins = list("remove_button"),
create = TRUE,
@trinker
trinker / formattable_example
Last active May 14, 2017 22:44
formattable_example
p_load(formattable)
DF <- data.frame(Ticker=c("", "", "", "IBM", "AAPL", "MSFT"),
Name=c("Dow Jones", "S&P 500", "Technology",
"IBM", "Apple", "Microsoft"),
Value=accounting(c(15988.08, 1880.33, NA,
130.00, 97.05, 50.99)),
Change=percent(c(-0.0239, -0.0216, 0.021,
-0.0219, -0.0248, -0.0399)))
DF
## Ticker Name Value Change
@trinker
trinker / dumbellplot
Created April 16, 2017 17:27
Dumbell plot
dat <- data.frame(
freq = c(37, 88, 47, 89, 28, 68, 65, 98, 68, 86, 50, 87, 59, 82, 45, 65, 52, 32, 59, 47, 68, 78, 39, 31, 64, 68)
)
dat[["sector"]] <- rep(c("U.S. adults", "AAAS scientist"), nrow(dat)/2)
field <- c("Biomedical sciences", "Climate, energy, space sciences")
dat[["field"]] <- factor(rep(field, c(10, 16)), levels=field)
items <- c(
@bschwartz757
bschwartz757 / async.js
Last active November 15, 2023 03:23
Async/await function to fetch data from multiple URLs in parallel
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@trinker
trinker / Bar In Bar
Created March 24, 2017 21:09
Bar in Bar
if (!require("pacman")) install.packages("pacman"); library(pacman)
p_load(tidyverse, cowplot)
cols <- c(lightblue = '#62B1F6', darkblue = '#27408B')
dat <- data_frame(
type = state.name[1:18],
Total = c(522, 464, 332, 185, 90, 811, 121, 242, 258, 175, 346, 217, 186, 133, 144, 136, 53, 306),
Sub = c(6, 6, 13, 19, 21, 11, 7, 8, 16, 29, 78, 71, 90, 68, 90, 99, 35, 14)
)
@jcavat
jcavat / Dockerfile
Last active April 15, 2025 17:40
docker-compose with php/mysql/phpmyadmin/apache
FROM php:7.1.2-apache
RUN docker-php-ext-install mysqli
@keithweaver
keithweaver / save-video-w-opencv.py
Created March 9, 2017 15:01
Stream and save video in Python with OpenCV
# For more info: http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_display/py_video_display.html
import cv2
import numpy as np
import os
FILE_OUTPUT = 'output.avi'
# Checks and deletes the output file
# You cant have a existing file or it will through an error
if os.path.isfile(FILE_OUTPUT):