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/ruby | |
# sa-retrain.rb | |
# to be used to pipe mail into sa-lean, from postfix | |
# postfix master.cf can be setup like so: | |
# | |
# sa-retrain unix - n n - 10 pipe | |
# flags=Ru user=amavis argv=ruby /usr/local/bin/sa-retrain.rb $nexthop $sender $recipient | |
# | |
# then setup some transport like so in /etc/postfix/transport: | |
# |
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
# RUBY | |
require 'openssl' | |
require 'digest/sha2' | |
require 'json' | |
def bin2hex(str) | |
str.unpack('C*').map{ |b| "%02X" % b }.join('') | |
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
class AssetOriginInjectionMiddleware | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
# this is a weird hack. what it does is | |
# add the production origin access allowed origin header | |
# of the production sites url | |
# if we happen to be serving an asset. |
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
COLOR_YELLOW="\[\e[33;40m\]" | |
COLOR_RED="\[\e[31;40m\]" | |
COLOR_GREEN="\[\e[32;40m\]" | |
COLOR_BLUE="\[\e[34;40m\]" | |
COLOR_NONE="\[\e[0m\]" | |
COLOR_NONEP="\[\e[38;40m\]" | |
git_dirty_flag() { | |
git status 2> /dev/null | grep -c : | awk '{if ($1 > 0) print "⚡"}' | |
} | |
parse_git_branch() { |
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/ruby | |
# Ruby version of dspam-retrain perl script. | |
# Perl version: http://dspamwiki.expass.de/DspamRetrainScript | |
# Author: [email protected] | |
# License: BSD | |
# Abstract: setup postfix to pipe mail into this script | |
# so that we may then pass it off to dspam in | |
# an appropriate way. | |
# | |
# dspam-retrain.rb handles [email protected], and |
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
def duration(filename) | |
f = File.open(filename, 'r') | |
raise "Could not open File!" unless f | |
#check for flv text | |
unless f.read(3) === 'FLV' | |
raise "This does not seem to be an FLV file." | |
end | |
#check to make sure we are a video |
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' | |
gem 'feedtools' | |
gem 'htmltokenizer' | |
require 'feed_tools' | |
require 'html/htmltokenizer' | |
require 'twitter' | |
require 'net/http' | |
#your redmine url |