Skip to content

Instantly share code, notes, and snippets.

@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'
@iacovlev-pavel
iacovlev-pavel / geoserver-install.sh
Last active May 8, 2022 06:55
Install GeoServer on Ubuntu 18.04
#
apt-get install openjdk-8-jre
# PostgreSQL and PostGIS
apt-get install postgresql postgresql-contrib postgis postgresql-10-postgis-2.4
# Create "geoserver" database
sudo -u postgres createuser -P geoserver
sudo -u postgres createdb -O geoserver geoserver
sudo -u postgres psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" geoserver
@echo off
echo %0.bat - Reading all Shapefiles from a directory into a GeoPackage file
rem Constants
set version=Version 0.1
set outfile=geopackage.gpkg
rem Checking if OGR is installed and in program path
ogr2ogr --version >nul
if not %errorlevel%==0 goto ogrnotfound
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active May 2, 2024 01:27
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@tbadams45
tbadams45 / uiOutput-in-modules.R
Last active June 28, 2023 18:25
How to use renderUI in shiny modules. Main takeaway: session$ns("id"). This works in nested modules, too. See the section on session$ns in the documentation for more information: http://shiny.rstudio.com/reference/shiny/latest/session.html
library(shiny)
library(dplyr)
library(ggplot2)
innerModUI <- function(id) {
ns <- NS(id)
fluidPage(fluidRow(
uiOutput(ns("inner_slider")),
@jcheng5
jcheng5 / README.md
Last active December 15, 2022 16:01
Using arbitrary Leaflet plugins with Leaflet for R

Using arbitrary Leaflet JS plugins with Leaflet for R

The Leaflet JS mapping library has lots of plugins available. The Leaflet package for R provides direct support for some, but far from all, of these plugins, by providing R functions for invoking the plugins.

If you as an R user find yourself wanting to use a Leaflet plugin that isn't directly supported in the R package, you can use the technique shown here to load the plugin yourself and invoke it using JS code.

@withr
withr / server.R
Last active October 24, 2018 14:05
Who touched my shiny-app?
shinyServer(function(input, output) {
datasetInput <- reactive({
switch(input$dataset,
"rock" = rock,
"pressure" = pressure,
"cars" = cars)
})
output$caption <- renderText({
@srvanderplas
srvanderplas / jqfp.js
Last active June 17, 2023 04:58
Shiny user fingerprint (md5 hash of browser characteristics) and ip address demo. The .R files are in the working directory ("./"), the .js files must be placed in ./www/js/ to be accessible. I wrote the R code, which I will release under the same WTF license as the jqfp.js library is released under.
// Browser fingerprinting is a technique to "mark" anonymous users using JS
// (or other things). To build an "identity" of sorts the browser is queried
// for a list of its plugins, the screen size and several other things, then
// hashes them. The idea is that these bits of information produce an unique
// "fingerprint" of sorts; the more elaborate the list of data points is, the
// more unique this fingerprint becomes. And you wouldn't even need to set a
// cookie to recognize this user when she visits again.
//
// For more information on this topic consult
// [Ars Technica](http://arstechnica.com/tech-policy/news/2010/05/how-your-web-browser-rats-you-out-online.ars)