Skip to content

Instantly share code, notes, and snippets.

@langmi
langmi / node-and-npm-in-30-seconds.sh
Created February 25, 2012 17:26 — forked from isaacs/node-and-npm-in-30-seconds.sh
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 http://npmjs.org/install.sh | sh
@langmi
langmi / get_memory_vps.sh
Created July 23, 2012 21:39
shows free and available vps memory on a shared server
#!/bin/bash
# von/from http://devnulled.com/content/2007/06/how-to-display-linux-vps-memory-usage/
bean=`cat /proc/user_beancounters`
guar=`echo "$bean" | grep vmguar | awk '{ print $4;}'`
burst=`echo "$bean" | grep privvm | awk '{ print $5;}'`
priv=`echo "$bean" | grep privvm | awk '{ print $2;}'`
let total=guar/256
let used=priv/256
let burst=burst/256
echo "VPS memory usage:"