Skip to content

Instantly share code, notes, and snippets.

@sbuzonas
sbuzonas / deploy
Last active January 17, 2016 06:22
OpenShift deploy hook to install composer capable of running against php 5.4 with the zend6.1 cart
#!/usr/bin/env bash
GIT_DIR_SAVE=$GIT_DIR ; unset GIT_DIR
GIT_WORK_TREE_SAVE=$GIT_WORK_TREE ; unset GIT_WORK_TREE
if [ ! -f "${OPENSHIFT_DATA_DIR}composer/bin/composer" ]; then
export COMPOSER_HOME="${OPENSHIFT_DATA_DIR}.composer"
echo $COMPOSER_HOME > ${OPENSHIFT_HOMEDIR}.env/user_vars/COMPOSER_HOME
echo "Installing composer"
curl -s https://getcomposer.org/installer | env - PATH="/usr/bin:$PATH" php -- --install-dir=$OPENSHIFT_DATA_DIR >/dev/null
@yourcelf
yourcelf / soma.py
Last active June 10, 2019 14:32
Command line script to play somafm radio stations. Type `soma.py --help` for usage, but briefly: `soma.py <stationname>` plays the station, `soma.py` with no argument lists the available stations. Uses mplayer to do the playing (change with --player option).
#!/usr/bin/env python
from __future__ import print_function
import sys
import subprocess
import argparse
import textwrap
import signal
stations = {
@markusfisch
markusfisch / README.md
Last active March 28, 2025 12:20
Generate a bar chart by reading value/label pairs from stdin

Bar charts from stdin

Put this shell script somewhere in your path and run it by feeding it value/label pairs like this:

$ bars
10 one
20 two
30 three
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active April 14, 2025 11:07
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