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
const DIRECTION_DOWN = -1; | |
const DIRECTION_NONE = 0; | |
const DIRECTION_UP = 1; | |
function HardwareElevator() {} | |
HardwareElevator.prototype = { | |
moveUp: function() { console.log("up") }, | |
moveDown: function() { console.log("down") }, | |
stopAndOpenDoors: function() { console.log("stop and open") }, |
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
const flatten = a => a.reduce((memo, value) => { | |
return Array.isArray(value) ? | |
[...memo, ...flatten(value)] : | |
[...memo, value] | |
}, []) |
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
FROM node:8-alpine | |
RUN apk add --update curl && \ | |
rm -rf /var/cache/apk/* | |
# Add the patch fix | |
# see https://github.com/sass/node-sass/issues/2031 https://github.com/esnme/ultrajson/issues/254#issuecomment-314862445 | |
RUN curl -o /lib/stack-fix.c "https://gist.githubusercontent.com/amok/daa16ae28fd10481ba1eca50c855d45e/raw/a087786e9f218afd6d1397eaa82ee44fa81eb660/stack-fix.c" | |
# Prepare the libraries packages |
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
/* | |
There is an AST (Abstract syntax tree) in JSON format. | |
AST represents Excel spreadsheet formula. | |
Is it possible in JavaScript to make RPN (Reverse Polish Notation) faster than AST? | |
AST evaluation is recusive and RPN evaluation is iterative. | |
But in any case, AST evaluation is faster despite recursion. | |
I guess that the main problem is in using dynamic js arrays to emulate stack. | |
Would RPN win if it was written in C/C++? | |
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 | |
# Author: Alexander Schulz | |
VHOSTEN="/etc/nginx/sites-enabled/" | |
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]] | |
then | |
echo 'Usage: n2dissite VHOST' | |
echo 'Disables Nginxs virtualhost VHOST.' |
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/sh | |
if [ "$(id -u)" != "0" ]; then | |
echo "$0 must be run as root" | |
exit 1 | |
fi | |
echo 'Internet required for this to work' | |
cd ~ |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>HTML5 boilerplate</title> | |
<link rel="stylesheet" href="css/style.css"> | |
<script src="js/main.js"></script> | |
</head> | |
<body> | |
<h1>HTML5 boilerplate</h1> |
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/sh | |
sudo add-apt-repository -y "deb http://archive.canonical.com/ $(lsb_release -sc) partner"; # skype | |
sudo add-apt-repository -y ppa:indicator-multiload/stable-daily # system monitor applet | |
apt-get update; | |
apt-get -y upgrade; | |
apt-get -y install build-essential linux-headers-generic linux-headers-`uname -r`; | |
apt-get install -y curl; |
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
if [ -t 1 ]; | |
then | |
setfont /usr/share/consolefonts/CyrSlav-Terminus14.psf.gz &> /dev/null | |
fi | |
PS1='\[\033[01;32m\]\u\[\033[01;34m\]\[\033[0;37m\]@\[\033[01;31m\]\h\[\033[01;34m\]\w/\[\033[0;37m\]\[\033[1;33m\]$(__git_ps1 "[%s]")\[\033[0;37m\]\$ \[\033[0m\]' | |
function kill-voracious() { | |
process=(`ps -u $USER -o pid,comm --sort %cpu | tail -n 1`); | |
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 | |
# From: http://askubuntu.com/questions/165192/how-do-i-install-drivers-for-the-atheros-ar8161-ethernet-controller | |
# must be runned as root | |
if [ "$(id -u)" != "0" ]; then | |
echo "$0 must be run as root" | |
exit 1 | |
fi | |
echo 'Rebuilding drivers for Atheros ar8161 Ethernet Controller...' |
NewerOlder