Skip to content

Instantly share code, notes, and snippets.

View bedantaguru's full-sized avatar

Indranil Gayen bedantaguru

View GitHub Profile
@bedantaguru
bedantaguru / server.R
Created July 1, 2017 18:22 — 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) {
@bedantaguru
bedantaguru / demo.R
Last active September 1, 2017 06:43
Defining Variable in R Package Environment
progress_print <- function(){
L <- list(init = function(x) {M <<- x}, step = function() NULL, term = function() NULL)
itr <- 0
M <- 1
L$step <- function(){
itr <<- itr + 1
cat(paste0("Job ", itr, " out of ", M, "\n"))
}
return(L)
}
@bedantaguru
bedantaguru / countyfips_leaflet.R
Created September 4, 2017 07:22 — forked from keberwein/countyfips_leaflet.R
A leaflet map for R built on a shape file of US counties
library(sp)
library(rgeos)
library(rgdal)
library(maptools)
library(dplyr)
library(leaflet)
library(scales)
### Begin data prep
# Grab air/water quality data from the EPA
url = "https://data.cdc.gov/api/views/cjae-szjv/rows.csv?accessType=DOWNLOAD"
@bedantaguru
bedantaguru / app.R
Created November 17, 2017 10:11 — forked from leonawicz/app.R
Use custom local image files as icons in a Shiny Dashboard value box
#
# This Shiny web application demonstrates the use of custom image files
# in place of icons for value boxes in Shiny Dashboard by overriding two
# functions:
#
# 'icon' from the shiny package and 'valueBox' from the shinydashboard package.
#
# Each function adds minimal, specific additional handling of image files.
# Note: A custom css file must also be included so that value boxes can
# display the icons. For that reason, do not expect images in place of icons to
@bedantaguru
bedantaguru / SuffixArray_LRS.cpp
Created March 10, 2018 07:58 — forked from dipu-bd/SuffixArray_LRS.cpp
Logest Repeated Substring (LRS) using suffix array. Complexity: O(n.log(n))
/*====================================================================
Title: Computes Longest Repeated Substring from a given string
Complexity: O(n.log(n))
Author : Sudipto Chandra (Dipu)
=====================================================================*/
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a, b, sizeof(a))
#define loop(i, x) for(__typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)
#define rloop(i, x) for(__typeof((x).rbegin()) i=(x).rbegin(); i!=(x).rend(); ++i)
@bedantaguru
bedantaguru / tapered-intensity-curved_edges.R
Created August 10, 2018 05:45 — forked from dsparks/tapered-intensity-curved_edges.R
Beautiful tapered-intensity-curved edge network graph with ggplot2
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("sna", "ggplot2", "Hmisc", "reshape2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Empty ggplot2 theme
new_theme_empty <- theme_bw()
new_theme_empty$line <- element_blank()
new_theme_empty$rect <- element_blank()
new_theme_empty$strip.text <- element_blank()
@bedantaguru
bedantaguru / unlockEnvironment.r
Created September 18, 2019 04:59 — forked from wch/unlockEnvironment.r
Sample code for unlocking environments in R
library(inline)
inc <- '
/* This is taken from envir.c in the R 2.15.1 source
https://github.com/SurajGupta/r-source/blob/master/src/main/envir.c
*/
#define FRAME_LOCK_MASK (1<<14)
#define FRAME_IS_LOCKED(e) (ENVFLAGS(e) & FRAME_LOCK_MASK)
#define UNLOCK_FRAME(e) SET_ENVFLAGS(e, ENVFLAGS(e) & (~ FRAME_LOCK_MASK))
'
@bedantaguru
bedantaguru / selenium_opera_vpn.py
Created November 29, 2020 11:23 — forked from tyjeon24/selenium_opera_vpn.py
Python:Selenium opera with vpn
# Before running the code...
# 1. Set VPN function in Opera
# 2. Download Opera Webdriver from https://github.com/operasoftware/operachromiumdriver/releases
# 3. Type about://about in Opera and get profile path and installation path.
# 4. Set the variables.
# opera_profile = r"C:\profile path"
# options._binary_location = r"C:\\installation path."
from selenium import webdriver