Skip to content

Instantly share code, notes, and snippets.

import sys
import getopt
import os, boto, shutil, subprocess, random, datetime
import os.path
from boto.s3.key import Key
from boto.s3.connection import Location
aws_key = 'your key'
aws_secret_key = 'your secret'
default_bucket = 'testing_0001'
# show all the buckets
python s3_backup.py lb
# list bucket content
python s3_backup.py l bucketname
# upload file to bucket
python s3_backup.py u bucketname filename
# download file from bucket
<a href="javascript:var%20Bitly={url:'<?php the_permalink() ?>'},e=document.createElement('script');e.setAttribute('language','javascript');e.setAttribute('src','http://bit.ly/bookmarklet/load.js');document.body.appendChild(e);void(0);">Bit.ly this!</a>
@luca
luca / 9.04.sh
Created January 28, 2010 12:16 — forked from mrrooijen/9.04.sh
# Author: Michael van Rooijen
# Description:
# A Rails Stack Installer for Ubuntu 8.04/9.04 with the light-weight and fast NginX Web Server.
# This shell script will install a basic Rails Stack with a bunch of useful and commonly used utilities.
# It will install Ruby Enterprise Edition with Phusion Passenger (Reduces Rails Application Memory Usage By Approx. 33%)
# It will install some essential gems like mysql, sqlite, postgres etc.
# It will install NginX Web Server
# It will install the MySQL database
# It will install Git
# It will install these utilities: ImageMagick, FFMpeg, Memcached
# ------------------------------------------------------------------
# Desigining "trending topics in 24 hours sliding window" with Redis
# ------------------------------------------------------------------
redis-cli del tophashes:2010-12-07-08-00
redis-cli del tophashes:2010-12-07-09-00
redis-cli del tophashes:current
echo '=== 8:00 AM ==='
@luca
luca / engine_template_generator.py
Created August 17, 2011 09:07 — forked from Goles/engine_template_generator.py
Gando Games Automatic Engine Template Generation
#!/usr/bin/python
import shutil
import sys
import os
import subprocess
ROOT_PATH = "GGEngine/"
SRC_PATH = "src/gengine"
GG_USERNAME = "username"
GIT_REPO_URL = "ssh://" + GG_USERNAME + "@gandogames.com/path/to/engine.git "
@luca
luca / Fire.lua
Created November 20, 2011 16:39 — forked from juaxix/Fire.lua
Towers versus Zombies by @juaxix -- LGPL - 11/2011 - Codea
Fire = class()
-- Towers versus Zombies by @juaxix
-- LGPL - 11/2011 
-- http://videojuegos.ser3d.es
-- it is a pleasure to gift this to the world 
-- thanks from heart to all the 2lifesleft team
function Fire:init(attackpower,position,model)
    self.attackpower = attackpower
    self.position    = position
    self.parent      = model
@luca
luca / _flash.html.erb
Created January 18, 2012 07:41 — forked from potomak/_flash.html.erb
Rails flash messages using Twitter bootstrap
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@luca
luca / config.ru
Created March 6, 2012 13:01
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by
@luca
luca / apf_release.prepend.js
Created June 22, 2012 08:11 — forked from SchizoDuckie/apf_release.prepend.js
Cloud9 IDE Touch Enabler Monkeypatch
/**
* A proof of concept monkeypatch to make Cloud9 IDE work on a tablet.
* Since i'm an extremely lazy bastard I prepended this snippet directly in package/client/js/apf_release.js
*
* What does it do?
* - It fires a doubleclick for a 2-finger tap
* - It fires a mousewheel up / down event for a 2-finger swipe up / down.
*
* How does it work?
* Prepend the functions below to <cloud9>/package/client/js/apf_release.js, save, load in tablet.