Skip to content

Instantly share code, notes, and snippets.

@hpetru
hpetru / base.rb
Created November 15, 2021 10:56 — forked from bensie/base.rb
Sinatra API Helpers
require "sinatra/base"
require "sinatra/namespace"
require "multi_json"
require "api/authentication"
require "api/error_handling"
require "api/pagination"
module Api
class Base < ::Sinatra::Base
@hpetru
hpetru / gist:4cbc31c634e3282d8bb756979c52b3dc
Created April 6, 2016 14:42 — forked from nside/gist:8078726
scrapyd logs grokking for logstash kibana elasticsearch
filter {
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:ts} \[%{USERNAME:spider}\] %{LOGLEVEL:level}: Crawled %{NUMBER:pages2:int} pages \(at %{NUMBER:pages_rate2:int%} pages/min\), scraped %{NUMBER:items2:int} items \(at %{NUMBER:items_rate2:int%} items/min\)" ]
}
}
#!/usr/bin/env ruby
module W
class Token
attr_reader :value, :tags
def initialize(value)
@value = value
@tags = []
end
class Tag
class << self
attr_accessor :match
attr_accessor :children
end
self.children = []
def self.inherited(klass)
Tag.children << klass
uses crt;
type ara=array[1..10,1..10] of integer;
var t:ara;
n:integer;
f:text;
procedure citire(m:integer);
var i,j,k:integer;
begin
k:=1;
CREATE OR REPLACE FUNCTION process_timetravel_before() RETURNS TRIGGER AS $timetravel_before$
DECLARE
temp_row RECORD; -- a temporary variable used on updates/deletes
time_now TIMESTAMP; -- get the time now just once.... for consistency's sake
BEGIN
time_now = now();
IF (TG_OP = 'UPDATE' OR TG_OP = 'DELETE') THEN
-- the user should not be able to update historic rows
#!/bin/bash
#
# Install Postgres 9.2 on a clean Ubuntu 12.04
"""
LC_ALL issue
comment out the AcceptEnv LANG LC_* line in the remote /etc/ssh/sshd_config file.
sudo apt-get install language-pack-en-base
sudo dpkg-reconfigure locales
comment out the SendEnv LANG LC_* line in the local /etc/ssh/ssh_config file.
[
{"US":"United States"},
{"CA":"Canada"},
{"AF":"Afghanistan"},
{"AL":"Albania"},
{"DZ":"Algeria"},
{"DS":"American Samoa"},
{"AD":"Andorra"},
{"AO":"Angola"},
{"AI":"Anguilla"},
@hpetru
hpetru / normalize.css
Created January 12, 2013 17:05
normalize.css
/*! normalize.css v2.0.1 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/*
* Corrects `block` display not defined in IE 8/9.
*/