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 index | |
@events = Event.all | |
@events_by_month = Event.find(:all).group_by { |event| event.eventdate.strftime("%B") } | |
# The answer | |
@events_by_month = Event.find(:all, :conditions => "live = true").group_by { |event| event.eventdate.strftime("%B") } | |
respond_to do |format| | |
format.html # index.html.erb | |
format.xml { render :xml => @events } | |
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
@artworks = Artwork.find(:all, :include => :artist, order => "artists.last_name, title") |
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
font:normal normal normal 13px/1.5 Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif; |
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
hda: status error: status=0x58 { DriveReady SeekComplete DataRequest } | |
hda: status error: error=0x00 | |
hda: drive not ready for command | |
hda: status error: status=0xd8 { Busy } | |
hda: status error: error=0x00 | |
hda: drive not ready for command |
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 show | |
@event = Event.find(params[:id]) | |
if @event.hits.nil? | |
@event.hits = 0 | |
else | |
@event.hits = @event.hits + 1 | |
end | |
@event.save | |
respond_to do |format| |
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 | |
BACKUP="/backups/db" | |
DATE=`date +"%Y-%m-%d"` | |
WEEKAGO=`date --date='week ago' +"%Y-%m-%d"` | |
DAY=`date +"%a"` | |
XWEEKSAGO=`date --date='5 weeks ago' +"%Y-%m-%d"` | |
# Day on which the weekly backup is kept. Should be the 3 char abbreviation | |
WEEKLY="Sun"; |
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
-- Grab the last 7 days of load notifications | |
select from_unixtime(notification_history.dts), server.servername, notification_history.message | |
from server, service, notification_history | |
where service.server_id = server.server_id | |
and notification_history.service_id = service.service_id | |
and notification_history.message like '%Load%' | |
and from_unixtime(notification_history.dts) >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) | |
order by server.servername desc; |
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
time echo "scale=5000; 4*a(1)" | bc -l -q |
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 | |
# Script to check if port 22 (SSH) is open within the range, secondly if our SSH key is accepted by that server. | |
# Insert your SSH Key here | |
KEYPUB="/link/root/.ssh/file"; | |
RANGES="0.0.0.0/0 1.1.1.1/1" | |
for i in `nmap -sT -n -p 22 -P0 -oG - $RANGES | grep open | awk '{print $2}'` | |
do |
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 'yourls' | |
# For each URL provided in the argument list | |
# run through it and shorten it. | |
ARGV.each do|a| | |
# Create a new Yourls instance with the shortener URL and API key. | |
yourls = Yourls.new('http://bkenn.me', your_api_key_here) | |
# Pass it the argument/url provided from the command line to shorten. | |
tiny = yourls.shorten("#{a}") |
OlderNewer