Skip to content

Instantly share code, notes, and snippets.

@Dulani
Dulani / vboxcl.sh
Last active October 23, 2018 03:55
VirtualBox Command Line Gists
#Reference: https://www.thomas-krenn.com/en/wiki/Headless_Mode_for_Virtual_Machines_of_VirtualBox
#List available VMs:
VBoxManage list vms
#Run a particular VM in headless mode:
$ VBoxHeadless -startvm ubuntu-server
#Assuming port forwarding has been set up from 22 to 2222 (in the GUI):
ssh -p 2222 <username>@localhost
@Dulani
Dulani / docker_gists.md
Last active October 17, 2018 05:23
Favorite commands for use with Docker

Docker Favorites

Build an image with a dockerfile: docker build - < Dockerfile

Add a name to the image (after building it):

docker tag <image ID> <image name>:latest

e.g. docker tag dbfee88ee9fd windowsservercore:latest

@Dulani
Dulani / Rmarkdown notebooks.md
Last active October 18, 2018 21:20
Little things I always have to look up for R Markdown notebooks.

Set up the notebook so that it automatically hides the code chunks in the .nb.html:

output: 
  html_notebook:
    code_folding: hide

Print more table output rows for a particular chunk: {r, rows.print = 20}

#!/bin/bash
# --- Version history ---
# mrn: sleep for $freq instead of 3 seconds (forked)
# 0.4: added variable to store file path, and $2 for base file name
# added variable to store desired reporting interval
# 0.3: added $1 to send in process ID at run time.
# 0.2: switched to $SECONDS for the loop. works.
# 0.1: didn't work well at all.
# --- Version history ---
@Dulani
Dulani / pushpop.R
Created April 4, 2019 13:34 — forked from leeper/pushpop.R
One-line push and pop in R
# push
push <- function(x, values) (assign(as.character(substitute(x)), c(x, values), parent.frame()))
# pop
pop <- function(x) (assign(as.character(substitute(x)), x[-length(x)], parent.frame()))
# example
z <- 1:3
push(z, 4)
z
@Dulani
Dulani / idletime.sh
Created April 18, 2019 14:33 — forked from Neil-Smithline/idletime.sh
Mac OS X Idle Time Shell Script
#!/bin/sh
# Get MacOSX idletime. Shamelessly stolen from http://bit.ly/yVhc5H
/usr/sbin/ioreg -c IOHIDSystem | /usr/bin/awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'
@Dulani
Dulani / miniconda_on_rpi.md
Created September 15, 2019 00:43 — forked from simoncos/miniconda_on_rpi.md
Install Miniconda 3 on Raspberry Pi

How to set up a "Headless" Raspberry Pi with my typical configurations (and preferred tools).

Goal: To put all of my infrquently used setups stuff in one place. Tested on: A Pi2 B (arm6l) with a fresh Raspbian Buster OS

Setup the OS, connections, and logins

yum install httpd yum-utils createrepo
@Dulani
Dulani / README.md
Created October 17, 2019 23:47 — forked from timelyportfolio/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.