This file contains hidden or 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
WITH params AS (SELECT '192.168.1.1' AS ip, | |
'2012-12-31' AS min_date) | |
SELECT a.id, | |
a.server_id, | |
a.rule_id, | |
('1970-01-01'::timestamp + (a.timestamp::text || ' seconds')::interval) AS timestamp, | |
a.location_id, | |
integer_to_inet(a.src_ip) AS src_ip, | |
integer_to_inet(a.dst_ip) AS dst_ip, | |
CASE WHEN a.src_port = 0 THEN NULL ELSE a.src_port END AS src_port, |
This file contains hidden or 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
WITH | |
del_data AS ( | |
DELETE | |
FROM data | |
WHERE EXISTS ( | |
SELECT id | |
FROM alert | |
WHERE timestamp <= EXTRACT(EPOCH FROM (NOW() - '1 year'::interval))::integer AND | |
data.id = alert.id | |
) |
This file contains hidden or 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
\version "2.16.2" | |
\header { | |
title = "Wedding March" | |
composer = "Felix Mendelssohn" | |
} | |
dfnat = \markup \concat \vcenter { F \natural D \natural } | |
dfshp = \markup \concat \vcenter { F \sharp D \sharp } | |
cshp = \markup \concat \vcenter { C \sharp } | |
cfswp = \markup \concat \vcenter { C \natural F \sharp } |
This file contains hidden or 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
# execute a command using an installed ruby/gemset | |
rvm::exec { 'start-myapp': | |
local => 'apache', | |
ruby_version => '1.9.3-p394', | |
gemset_name => 'myapp', | |
user => 'apache', | |
group => 'apache', | |
binary => 'thin', | |
arguments => ['start', '-p', '9292', '-P', '/var/run/myapp.pid'], | |
creates => '/var/run/myapp.pid', |
This file contains hidden or 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 MyApp | |
class APIError < Exception; end | |
class Web < Sinatra::Base | |
def self.api(&block) | |
# some crazy stuff to wrap any get/put/delete/post/patch | |
# requests into a block with automatic error handling, and | |
# pass on all other requests to the sinatra base class. | |
end |
This file contains hidden or 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 'sequel' | |
require 'logger' | |
DB = Sequel.postgres('steve', :host => 'localhost') | |
DB.loggers << Logger.new($stdout) | |
# DB.run 'CREATE TABLE cars (id SERIAL PRIMARY KEY, asdf TEXT NOT NULL) WITHOUT OIDS;' | |
class Car < Sequel::Model | |
end |
This file contains hidden or 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 Sequel | |
class Model | |
end | |
end | |
module Models | |
class User < Sequel::Model; end | |
class Post < Sequel::Model; end | |
end |
This file contains hidden or 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
\version "2.16.2" | |
\header { | |
title = "Ombra Mai Fu" | |
composer = "Georg Friederich Handel" | |
} | |
upper = \relative c' { | |
\clef treble | |
\key f \major | |
\time 3/4 |
This file contains hidden or 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
var responses = { | |
leader: function() { | |
bot.say(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '') | |
console.log(to, leaderboard_data.Passings[leaderboard_running[0].index].Driver.DriverName + ' is leading the race. ' + lapticker + '') | |
}, | |
luckydog: function() { | |
bot.say(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '') | |
console.log(to, leaderboard_data.Passings[leaderboard_luckydog].Driver.DriverName + ' is sitting in lucky dog position. ' + lapticker + '') | |
}, |
This file contains hidden or 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
<?php | |
function redirect($url, $exit_status = 1) { | |
header('HTTP/1.0 303 See Other', true, 303); | |
header("Location: $url"); | |
echo "<html><head><meta http-equiv='refresh' content='0;$url'></head>"; | |
echo "<body><script>window.location='$url'</script></body></html>"; | |
exit($exit_status); | |
} |