spec
|--- apis #do not put into controllers folder.
|--- your_api_test_spec.rb
|--- controllers
|--- models
|--- factories
|--- views
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
mkdir ./gif; for f in *.png; do y=${f%.png}; convert -dispose 3 -delay 0 -deconstruct -loop 0 ./$f -crop 40x40 +repage -depth 4 ./gif/$y.gif; echo "Converting $y to GIF"; echo "—~—~—~—~—~—~—~—~—~—~—~–"; done |
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 "awesome_print" | |
module XmlParsing | |
require "ox" | |
class Reader < ::Ox::Sax | |
def initialize file_path, target, target_handler | |
@target_handler = target_handler | |
@target = target | |
@file_path = file_path |
Synology DSM 4.1 is vulnerable to BEAST and the Lucky Thirteen attacks out of the box. Switching to RC4 ciphers makes these attacks, and any other future CBC-targeting attacks, not work.
To fix this these 2 files need to be updated:
/usr/syno/apache/conf/extra/httpd-alt-port-ssl-setting.conf /usr/syno/apache/conf/extra/httpd-ssl.conf-common
Update them such that the line starting with SSLCipherSuite
is replaced with these two lines:
SSLHonorCipherOrder On
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 wget-ssl over ipkg's wget ### | |
######################################### | |
$ ipkg install -verbose_wget libidn # To get ipk URL | |
$ ipkg install -verbose_wget wget-ssl # To get ipk URL | |
$ /usr/syno/bin/wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/libidn_1.25-1_i686.ipk | |
$ /usr/syno/bin/wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/wget-ssl_1.12-2_i686.ipk | |
$ ipkg install libidn_1.25-1_i686.ipk | |
$ ipkg install wget-ssl_1.12-2_i686.ipk |
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
# I'm no benchmark guru. Just did a bunch of: | |
$ time ruby <filename> | |
# Note: This is just an 80mb XML file with 38,000 nodes. | |
ox_dom.rb 4.56s user 0.78s system 93% cpu 5.714 total (550mb) | |
ox_dom.rb 4.58s user 0.79s system 87% cpu 6.126 total (550mb) | |
ox_dom.rb 4.60s user 0.80s system 87% cpu 6.140 total (550mb) | |
nokigiri_dom.rb 11.75s user 1.02s system 94% cpu 13.518 total (895mb) | |
nokigiri_dom.rb 11.36s user 1.02s system 93% cpu 13.211 total (895mb) |
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/sh | |
### BEGIN INIT INFO | |
# Provides: delayed_job | |
# Required-Start: $all | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: | |
### END INIT INFO |
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
module PrefixedLogger | |
def prefixed_logger prefix | |
class << self | |
attr_reader :logger | |
end | |
@logger = ActiveSupport.TaggedLogger.new(Rails.logger) | |
@logger.instance_eval do | |
define_method :add do |severity, msg, *args, &block| | |
msg = "#{prefix} #{msg}" | |
super severity, msg, *args, &block |
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 | |
# | |
# DESCRIPTION: | |
# | |
# Set variables for various bash color codes to use in other bash scripts | |
# | |
# USAGE: | |
# | |
# 1. Save this file as ~/.bash_color_codes | |
# 2. Add the following line to your ~/.profile or ~/.bash_profile: |
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
# If your workers are inactive for a long period of time, they'll lose | |
# their MySQL connection. | |
# | |
# This hack ensures we re-connect whenever a connection is | |
# lost. Because, really. why not? | |
# | |
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
# | |
# From: | |
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
NewerOlder