Skip to content

Instantly share code, notes, and snippets.

@bhaskarvk
bhaskarvk / Setup GCC and CLANG Toolchains.md
Last active July 4, 2024 09:47
Proper GCC (vers. 5/6/7) & LLVM/CLANG (vers. 4/5) Toolchain Setup on Ubuntu/Linux Mint

This approach uses update-alternatives to manage GCC and LLVM/CLANG C/C++ compiler toolchains. Although tested on Linux Mint 18.3, this approach should work on any Debian based distro or for that matter any Linux distro with update-alternatives support, provided the packages are installed correctly.

There are 3 files

  • gcc-alternatives.sh installs GCC versions 5/6/7 and sets up alternatives for gcc/g++/cpp/gfortran.
  • llvm-clang-alternatives.sh installs LLVM and CLANG versions 4/5 and sets up alternatives for various LLVM and CLANG programs including clang and clang++.
  • cc-alternatives.sh sets up alternatives for the cc, cxx, and the ld commands. This script can be used to change systemwide default compiler/linker combination to either GCC or CLANG.

Once these scripts are run you can change the system GCC/CLANG versions by running sudo update-alternatives --config gcc|clang. To change the default compiler/linker combo used by t

@bhaskarvk
bhaskarvk / User2017-GeoDataViz-Tutorial-Setup.md
Last active July 5, 2017 04:33
Geospatial Data Visualization in R, A UseR! 2017 tutorial.

Geospatial Data Visualization using R

The goal of user2017.geodataviz is to privide a comprehensive overview of the options available in the R language for Geospatial data visualization. This tutorial covers ...

  • R Packages

  • R Data Structures for Spatial Data

  • Operations Supported on Spatial Data

@bhaskarvk
bhaskarvk / openblas-enable-clang.diff
Last active April 28, 2017 22:32
Diff files to make openblas compile on osx with clang-4.0 and openmp
diff --git a/Makefile.system b/Makefile.system
index b05177b..4b65edf 100644
--- a/Makefile.system
+++ b/Makefile.system
@@ -406,7 +406,7 @@ CCOMMON_OPT += -fopenmp
endif
ifeq ($(C_COMPILER), CLANG)
-$(error OpenBLAS: Clang didn't support OpenMP yet.)
+# $(error OpenBLAS: Clang didn't support OpenMP yet.)
@bhaskarvk
bhaskarvk / CRAN-Readability.md
Last active April 12, 2017 17:05
Readability improvements for 'r-project.org' sites.

Readability Improvements for 'r-project.org' sites.

A custom CSS for '*.r-project.org' websites, because the default styling or rather the lack of it makes my eyes bleed!

It is based on the skeleton-framework, a minimalist CSS f/w with some of my added customizations. Tested on Firefox, Chrome, Safari. (IE/Edge folks Switch to Firefox/Chrome/Safari ¯_(ツ)_/¯ )

Here are before and after comparison screenshots.

Before Styling

/* required styles */
.book .book-body .page-wrapper .page-inner section.normal .leaflet-map-pane,
.book .book-body .page-wrapper .page-inner section.normal .leaflet-tile,
.book .book-body .page-wrapper .page-inner section.normal .leaflet-marker-icon,
.book .book-body .page-wrapper .page-inner section.normal .leaflet-marker-shadow,
.book .book-body .page-wrapper .page-inner section.normal .leaflet-tile-pane,
.book .book-body .page-wrapper .page-inner section.normal .leaflet-tile-container,
.book .book-body .page-wrapper .page-inner section.normal .leaflet-overlay-pane,
.book .book-body .page-wrapper .page-inner section.normal .leaflet-shadow-pane,
@bhaskarvk
bhaskarvk / with-gdal-1.x.txt
Last active October 28, 2016 14:55
Problems with rgdal::readOGR and int64
> library(rgdal)
Loading required package: sp
rgdal: version: 1.1-10, (SVN revision 622)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 1.11.5, released 2016/07/01
Path to GDAL shared files: /usr/local/Cellar/gdal/1.11.5_1/share/gdal
Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.2-3
> spdf <- tigris::states()
R_BASEDIR=$HOME/Library/R/3.3
# Create 3 dirs in $R_BASEDIR library, library.github, library.cran
mkdir -p R_LIBS=$R_BASEDIR/library $R_BASEDIR/library.github $R_BASEDIR/library.cran
# Directory to log all output
mkdir -p $HOME/Library/Logs/R
export R_LIBS=$R_BASEDIR/library:$R_BASEDIR/library.github:$R_BASEDIR/library.cran
library(shiny)
library(leaflet)
library(htmltools)
library(htmlwidgets)
ui <- bootstrapPage(
tags$style(type = "text/css", "html, body {width:100%;height:100%}"),
leafletOutput("map", width = "100%", height = "100%")
)
library(leaflet)
library(htmltools)
library(htmlwidgets)
# Convert the JS and CSS from
# https://github.com/mapshakers/leaflet-icon-pulse/tree/master/src
# to proper URLs using rawgit.com
pluginDependency <- htmlDependency(
"leaflet-icon-pulse",version = "1.0",
@bhaskarvk
bhaskarvk / README.md
Created September 9, 2016 14:17 — forked from jcheng5/README.md
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.