Skip to content

Instantly share code, notes, and snippets.

@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
#!/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 / 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}

@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 / 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 / minecraft_commands.txt
Created September 30, 2018 02:26 — forked from Dinnerbone/minecraft_commands.txt
Minecraft Java Edition 1.13 changes
advancement grant <targets> everything
advancement grant <targets> from <advancement>
advancement grant <targets> only <advancement>
advancement grant <targets> only <advancement> <criterion>
advancement grant <targets> through <advancement>
advancement grant <targets> until <advancement>
advancement revoke <targets> everything
advancement revoke <targets> from <advancement>
advancement revoke <targets> only <advancement>
advancement revoke <targets> only <advancement> <criterion>
@Dulani
Dulani / gitlab-ci.yaml
Created August 8, 2018 00:22
Gitlab CI and deployment
image: php:5.6
stages:
- test
- build
- deploy
test:
stage: test
script: echo "Running tests"
@Dulani
Dulani / strip-autocomplete.user.js
Created August 7, 2018 15:54 — forked from david0/strip-autocomplete.user.js
Greasymonkey/Tampermonkey script that strips "autocomplete" attributes from username and password fields
// ==UserScript==
// @name Strip autocomplete attributes
// @namespace david0
// @version 0.1
// @description This plugin gives the control about your passwords back to your browser and allows the browser to store every password.
// @include http://*
// @include https://*
// @copyright 2014, David
// ==/UserScript==
@Dulani
Dulani / usingCodeCommitAWS.md
Created December 26, 2017 13:21 — forked from JohannMG/usingCodeCommitAWS.md
Setting Up AWS CodeCommit (Mac) with Sourcetree and disabling keychain

#Setting Up AWS CodeCommit (Mac)

For all possibilities, amazon has guides here: http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up.html

We chose to use HTTPS here

If git asks you to manually enter username or password it is incorrectly configured!

Similar to RSA, the AWS CLI credential-helper should be using your keys to create and send a dynamic password that updates every 15 minutes.

@Dulani
Dulani / notify.py
Created November 18, 2017 04:43 — forked from lukaszb/notify.py
Simple Python script to send notification to the OSX Notifications Center (requires OS X 10.8+). Tested with pyobjc 2.5.1
#!/usr/bin/env python
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
from optparse import OptionParser
def main():
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE')