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 | |
# Automated Cloud Backups to SpiderOak | |
# ----- | |
# Feel free to use this in any environment and | |
# modify it to your heart's content. | |
# ----- |
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
package chestnut | |
import java.io.{File, IOException} | |
import java.util.{ArrayList, List} | |
import javax.servlet.{ServletConfig, ServletException} | |
import javax.servlet.annotation.WebServlet | |
import javax.servlet.http.{HttpServlet, HttpServletRequest => HSReq, HttpServletResponse => HSResp} | |
import org.jruby.embed.{LocalContextScope, ScriptingContainer => Container} |
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 'RMagick' | |
module Dragonfly | |
module Processing | |
class AspectRatioProcessor | |
include Dragonfly::RMagickUtils | |
include Dragonfly::Configurable | |
configurable_attr :use_filesystem, true | |
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
# Place this in the config block on config/application.rb of your Rails application. | |
# Override where dragonfly keeps your images and its url format | |
config.to_prepare do | |
::Dragonfly[:images].configure do |c| | |
c.datastore.root_path = Rails.root.join('public', 'assets', 'images').to_s | |
c.url_format = '/assets/images/:job/:basename.:format' | |
end | |
end |
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 | |
# | |
# Brute-force way to retrieve all Github's repositories at once | |
# Usage: | |
# github_repos.rb clone # will clone all the user's repositories | |
# github_repos.rb clone test # will just clone 6 repositories for testing purposes | |
# github_repos.rb pull # will update all of the user's local repositories | |
# | |
# If you have forked repositories, the original sources will be added | |
# as remotes with the default 'forked_from' name, and a new 'forked_from' |
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 python | |
# -*- coding: utf-8 -*- | |
"""Kenneth Reitz's GitHub Syncer | |
This script uses the GitHub API to get a list of all forked, mirrored, public, and | |
private repos in your GitHub account. If the repo already exists locally, it will | |
update it via git-pull. Otherwise, it will properly clone the repo. | |
It will organize your repos into the following directory structure: |
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
alias :pputs :puts | |
def puts(str = "") | |
pputs(str) | |
$out << "#{str}" | |
end | |
STDOUT.instance_eval do | |
alias :pputs :puts | |
def puts(str = "") | |
pputs(str) |
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
These instructions have two purposes: 1) my own notes so I can more easily set up a new machine next time; 2) help for a Rails n00b to get a machine and a project set up without having to make all the same mistakes I did. | |
This walks you through setting up a remote Linux server and creating a Rails 3 project locally, using Github and Capistrano to collaborate and deploy. | |
Local -> means on your machine which should be a Unix variant (some OS X specifics may have snuck in) | |
Server -> means the server | |
Local -> | |
setup a /etc/hosts entry to map the IP to a simple name, hereafter 'server' |
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 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
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
#Original code from ActiveMerchant::PayPalNotification | |
#Modified by me to account for multiple items and custom flag | |
#Also bypassed the acknowledge if environment is "test" | |
require 'net/http' | |
class PayPalNotification | |
def initialize(params) | |
@ipn=params | |
end |
NewerOlder