Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# MongoDB Backup Script
# VER. 0.1
# Note, this is a lobotomized port of AutoMySQLBackup
# (http://sourceforge.net/projects/automysqlbackup/) for use with
# MongoDB.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active October 9, 2024 01:04
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
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@bert
bert / README
Created February 3, 2011 06:29
Embedding applications via XEmbed
From: gtk-list-bounces@gnome.org [mailto:gtk-list-bounces@gnome.org] On Behalf Of Andy Spencer
Sent: Friday, January 21, 2011 5:24 AM
To: Michael Treibton
Cc: gtk-list@gnome.org
Subject: Re: Embedding applications via XEmbed
On 2011-01-20 20:52, Michael Treibton wrote:
> I've read about GtkSocket and GtkPlug, but the examples for the
> official documentation don't make it clear to me how to go about this.
>
@weakish
weakish / busyroot.sh
Created April 19, 2011 11:06
#sh script to set up a #chroot #busybox #ssh environment
#!/bin/sh
# by Jakukyo Friel <weakish@gmail.com> under GPL v2.
### Set up a chroot busybox SSH environment
## requires
# wget -- to download pubkey and busybox
# sharutils -- to generate random password
## Config
@jimjeffers
jimjeffers / gist:1043333
Created June 23, 2011 19:05
Apple's Elastic CSS Animations
<!DOCTYPE html>
<html>
<head>
<!-- Apple nicely commented all of these transitions on their source file:
http://images.apple.com/global/styles/productbrowser.css -->
<style type="text/css" media="screen">
/* Just some basic presentational CSS for the example */
a {
background: #000; display: block; color: #fff;
font: 1.5em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif;
@louisremi
louisremi / animLoopX.js
Created July 29, 2011 17:34
Animation loop with requestAnimationFrame
// Cross browser, backward compatible solution
(function( window, Date ) {
// feature testing
var raf = window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.oRequestAnimationFrame;
window.animLoop = function( render, element ) {
var running, lastFrame = +new Date;
@cdown
cdown / gist:1163649
Last active September 25, 2024 14:24
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@jhurliman
jhurliman / base64.js
Created September 29, 2011 06:39 — forked from Marak/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers (plus url-safe versions)
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
* (C) 2011, Cull TV, Inc.
*
*/
var base64 = exports;
@dschnare
dschnare / equals.js
Created September 29, 2011 15:31
EqualsJS - Deep equality testing for JavaScript.
// Author: Darren Schnare
// Keywords: javascript,equality,testing,equals,object
// License: MIT ( http://www.opensource.org/licenses/mit-license.php )
// Repo: https://gist.github.com/1251001
// Creates an equals function within the specified scope.
(function(scope) {
// Determines if two objects have the same values. This is a
// recursive test that tests all objects through out the object
// tree.