Skip to content

Instantly share code, notes, and snippets.

@werty1st
werty1st / install.md
Created September 25, 2013 16:24 — forked from twilson63/install.md

Install CouchDb and NodeJS

Prereqs

sudo apt-get update -y
sudo apt-get install git-core build-essential -y

NodeJS 0.10.x

@werty1st
werty1st / OSX brew install encfs
Created September 27, 2013 22:58
OSX brew install encfs
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
brew install encfs --use-gcc
@werty1st
werty1st / gist:6801037
Created October 2, 2013 21:51
OSX hackintosh wrong cpu detection workaround with brew
/usr/local/Library/ENV/4.3/cc in a text editor and replace "-march=native" with "-march=core2".
@werty1st
werty1st / vbox autostart
Created December 4, 2013 19:36
vbox autostart
#!/bin/bash
#
#This init script autostarts necessary vms at boot
#and saves running vms on shutdown
# Sed explanation: sed -e 's/^.//' -e 's/.$//'
# 1. -e means to allow multiple arguments in a single sed command
# 2. 's/^.//' means to substitute (s) / at the beginning of the line (^), any character (.) / [substitute with nothing] /
# 3. 's/.$//' means to substitute (s) / any character (.), at the end of the line / [substitute with nothing] /

Three things to remember while configuring a couchapp to run as a web facing application. Below, I document the steps I took to deploy the example pages app from couchapp.org.

  1. set the vhost in /etc/couchdb/local.ini.

    [vhosts] home.btbytes.com = /pages/_design/pages/_rewrite

  2. add vhosts entry to couchdb by visiting configuration page in futon app and adding a new section:

# Add this line to your software sources
deb http://debian.meebey.net/experimental/mono /
sudo apt-get update
# of course, apt-get remove mono-complete first...
sudo apt-get install mono-complete
# I installed monodevelop from apt just to get all the prereqs
sudo apt-get install monodevelop
apt-get install ifenslave
echo "bonding" >> /etc/modules
cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo eth0 wlan0 bond0
iface lo inet loopback
# Do not receive dhcp on eth0
iface eth0 inet manual
@werty1st
werty1st / SUM_if_join_AS.sql
Created July 24, 2014 18:10
mysql join IF sum
SELECT ci.inventory_id, ci.inventory_quantity, cd.reservations, (ci.inventory_quantity + cd.reservations) as gesamt
FROM catalog_inventory ci
JOIN
(SELECT cd.documentation_inventory_nr, SUM(IF(cd.documentation_on >= UNIX_TIMESTAMP(NOW()),cd.documentation_quantity,0)) as reservations
FROM
catalog_documentation cd
GROUP BY cd.documentation_inventory_nr) as cd
ON cd.documentation_inventory_nr=ci.inventory_id
GROUP BY ci.inventory_id
var style = '.videoWrapper { position: relative; padding-bottom: 56.25%; /* 16:9 */ padding-top: 50px; height: 0;} .videoWrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:none;}';
var htmlDiv = document.createElement('style');
htmlDiv.innerHTML = style;
document.getElementsByTagName('head')[0].appendChild(htmlDiv);
String.prototype.toDOM=function(){
var d=document
,i
,a=d.createElement("div")
cat /etc/usbpower
#!/bin/bash
# This script attempts to read /sys/devices/ and identify usb ports and devices
# that can be toggled to enable wakeup from sleep.
#
# Version: 2.0
# Date written: August 20, 2012
#
# Copyright (C) 2012 danomac @ gentoo forums