Skip to content

Instantly share code, notes, and snippets.

Cody Caughlan ruckus

Block or report user

Report or block ruckus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View archive-rds-logs-to-s3.sh
#!/bin/bash
MONTH=`date +"%Y-%m"`
DAY=`date +"%d"`
THISHOUR=`date +"%H"`
LASTHOUR=`expr $THISHOUR - 1`
TIMESTAMP=`date +"%Y-%m-%d"`
TIMESTAMP="${TIMESTAMP}-${LASTHOUR}"
echo "Start: postgresql.log.${TIMESTAMP}"
@ruckus
ruckus / mailer_recipient_override.rb
Created Sep 9, 2016
Place in `config/initializers/mailer_recipient_override.rb` and be sure to define an environment variable for `EMAIL_RECIPIENT_OVERRIDE`
View mailer_recipient_override.rb
class OverrideMailReciptient
def self.delivering_email(mail)
if Rails.env.development?
original_to = mail.to
mail.to = ENV['EMAIL_RECIPIENT_OVERRIDE']
mail.subject = "[DEVELOPMENT] #{mail.subject} - Recipient: #{original_to}"
if mail.cc && mail.cc.any?
new_body = "#{mail.body}\n\nRemoved CC: recipients: #{mail.cc.join(", ")}"
mail.body = new_body
mail.cc = []
View Foo.java
@Bind(R.id.distributor)
TextView mDistributor;
@Bind(R.id.status)
TextView mStatus;
@Bind(R.id.order_date)
TextView mOrderDate;
@Bind(R.id.pickup_date)
TextView mPickupDate;
@Bind(R.id.delivery_date)
TextView mDeliveryDate;
@ruckus
ruckus / generate_butterknife_binds.rb
Created Sep 30, 2015
Auto-generate ButterKnife @Bind calls
View generate_butterknife_binds.rb
require 'rubygems'
require 'nokogiri'
xml = Nokogiri::XML(File.read(ARGV[0]))
xml.remove_namespaces!
class String
def camel_case
return self if self !~ /_/ && self =~ /[A-Z]+.*/
View axlsx_freeze_pane.rb
sheet.sheet_view do |sv|
sv.pane do |pane|
pane.top_left_cell = 'B1'
pane.state = :frozen
pane.x_split = 1
pane.active_pane = :top_right
end
end
View sheet1.xml
<sheetView windowProtection="false" tabSelected="false" showWhiteSpace="false" showOutlineSymbols="false" showFormulas="false" rightToLeft="false" showZeros="true" showRuler="true" showRowColHeaders="true" showGridLines="true" defaultGridColor="true" zoomScale="100" workbookViewId="0" zoomScaleSheetLayoutView="0" zoomScalePageLayoutView="0" zoomScaleNormal="0">
<pane topLeftCell="B1" state="frozen" activePane="topRight" ySplit="0" xSplit="1"/>
</sheetView>
@ruckus
ruckus / rds_download_logfiles.rb
Created Jan 9, 2015
Ruby script to download log files from RDS and archive to S3.
View rds_download_logfiles.rb
=begin
This script uses the AWS v2 API
Gemfile:
source "https://rubygems.org"
gem "aws-sdk", "2.0.17.pre"
@ruckus
ruckus / MainActivity.java
Created Sep 25, 2014
Example of using a ViewPager as a Header in a ListView. We need to explicitly set the layout params of the Header view because its not known at initialization time, in my case I am asynchronously loading images into the ViewPager.
View MainActivity.java
public class ProductDetailActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
final int width = displayMetrics.widthPixels;
mListView = (ListView)findViewById(R.id.product_detail_list_view);
View keybase.md

Keybase proof

I hereby claim:

  • I am ruckus on github.
  • I am toolbag (https://keybase.io/toolbag) on keybase.
  • I have a public key whose fingerprint is E0A2 B6E5 3211 66F3 C462 ADC6 90E5 F40B 708B A52A

To claim this, I am signing this object:

@ruckus
ruckus / gist:747c702d7ab7f4243c69
Created Aug 1, 2014
Sample result of QBO AgedReceivables report
View gist:747c702d7ab7f4243c69
{
"Header": {
"Time": "2014-07-01T08:51:36-07:00",
"ReportName": "AgedReceivables",
"StartPeriod": "2014-08-01",
"EndPeriod": "2014-08-01",
"Currency": "USD",
"Option": [
{
"Name": "report_date",
You can’t perform that action at this time.