This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# How to use | |
# my_script_name bd_user db_pass project_name(should be same name on database and project_directory) | |
# by Alfredo Ribeiro: [email protected] | |
# Create the daily backup, delete old backups, and each month, make a copy last backup on a separated directory | |
mysql_user=$1 | |
mysql_pass=$2 | |
project_name=$3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First parameter is a bash printf formatting string | |
# From second till fifth parameter, rvm-prompt format parameters | |
__ruby_ps1 () { | |
if [ ! -f ./Rakefile ] && | |
[ "$(find -maxdepth 1 -name '*.rb' | head -n1)" == "" ]; then | |
exit 1 | |
fi | |
if [ -f ~/.rvm/bin/rvm-prompt ]; then | |
rst=$(~/.rvm/bin/rvm-prompt $2 $3 $4 $5) | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'activesupport' | |
require 'chronic' | |
require 'optparse' | |
DAY_VALUE = 0 # regular value per day | |
WDAY_REGULAR = 1..5 # range for regular days 1..5 means from monday to friday | |
EXTRAS_VALUES = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as we’re going to use Unicorn as the application server | |
# we’re not going to use common sockets | |
# but Unix sockets for faster communication | |
upstream shop { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
# for UNIX domain socket setups: | |
server unix:/tmp/shop.socket fail_timeout=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as we’re going to use Unicorn as the application server | |
# we’re not going to use common sockets | |
# but Unix sockets for faster communication | |
upstream shop { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
# for UNIX domain socket setups: | |
server unix:/tmp/shop.socket fail_timeout=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for more info: https://gist.github.com/1120938 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rest-client" | |
begin | |
exists = RestClient.head("http://google.com").code == 200 | |
rescue RestClient::Exception => error | |
exists = (error.http_code != 404) | |
end | |
puts "exists=#{exists}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install system libraries. | |
sudo apt-get install zlib1g-dev openssl libssl-dev libreadline-dev git-core | |
# Install rbenv. | |
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv | |
# Setup bash. | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
exec $SHELL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<!--· | |
Include the script anywhere on your page, usually in the head |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<!-- | |
Include the script anywhere on your page, usually in the head | |
(don't forget to replace YOUR_WIDGET_SCRIPT with your CloudSponge key) | |
--> | |
<script src="//api.cloudsponge.com/widget/localhost-only.js"></script> | |
<script> | |
cloudsponge.init({ |
OlderNewer