This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
command -v foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; } | |
type foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; } | |
hash foo 2>/dev/null || { echo >&2 "I require foo but it's not installed. Aborting."; exit 1; } | |
# http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMAGE = IMAGENAME | |
CONTAINER = CONTAINERNAME | |
build: | |
docker build -t $(IMAGE) . | |
rebuild: | |
docker build -t --no-cache=true $(IMAGE) . | |
run: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data[47] | |
table(is.na(data)) | |
mean(data, na.rm=TRUE) | |
mean(data.R[which(data > 31 & data > 90)]) | |
mean(data[data == 6]) | |
max(data[data == 5], na.rm=TRUE) | |
by(iris$Sepal.Length, iris$Species == "virginica", mean)[2] | |
apply(iris[, 1:4], 2, mean) | |
with(mtcars, tapply(mpg, cyl, mean)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME=stub | |
apt-get -y update | |
apt-get -y upgrade | |
apt-get -y dist-upgrade | |
DEBIAN_FRONTEND=noninteractive apt-get -y install git docker.io mailutils pwgen | |
apt-get -y autoremove | |
apt-get -y autoclean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oTable = document.createElement('table'); | |
oTable.className = 'htCore'; | |
oTbody = document.createElement('tbody'); | |
oTr = document.createElement('oTr'); | |
oTd = document.createElement('oTd'); | |
oTd.appendChild(document.createTextNode('Text')); | |
oTr.appendChild(oTd); | |
oTbody.appendChild(oTr); | |
oTable.appendChild(oTbody); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// convert tabs to 4 spaces | |
find . -type f -exec sed -i 's/[ \t]*$//' {} \; | |
// remove trailing spaces | |
find . -type f -exec sed -i 's/[ \t]*$//' {} \; | |
// add new line at the end of file | |
find . -type f -exec sed -i -e '$a\' {} \; | |
// convert CRLF to LF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta http-equiv='Content-Type' content='text/html;charset=UTF-8' /> | |
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<link href="handsontable.full.css" rel="stylesheet"> | |
<script src="handsontable.full.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prepare to hold your colour | |
cd /usr/local/src/linux | |
cp /boot/config-$(uname -r) .config && make oldconfig | |
# enable CAIAQ module (CONFIG_SND_USB_CAIAQ=m) | |
# other recommended options: | |
# CONFIG_SND_DEBUG=y | |
# CONFIG_SND_DEBUG_VERBOSE=y | |
# CONFIG_SND_VERBOSE_PRINTK=y | |
make xconfig |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ shopt -s extglob | |
$ echo images/* | |
images/004.bmp images/033.jpg images/1276338351183.jpg images/2252.png | |
$ echo images/!(*.jpg) | |
images/004.bmp images/2252.png |
OlderNewer