Skip to content

Instantly share code, notes, and snippets.

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@OpenGrid
OpenGrid / Stone wall.js
Created June 28, 2012 16:12
Sigma 2012 Codility Programming Certificate Solution
/* http://blog.codility.com/2012/06/sigma-2012-codility-programming.html */
function stone_wall ( H ) {
var blocks = 0, stack = [], m, stack_length = 0;
for(m in H) {
// I use stack to remember all previous skyline levels
while(stack_length > 0 && stack[stack_length - 1] > H[m]) {
stack_length -= 1;
blocks += 1;