Skip to content

Instantly share code, notes, and snippets.

@sosedoff
sosedoff / 1_simple.go
Created July 16, 2016 18:45
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@sosedoff
sosedoff / agents.txt
Created June 27, 2011 21:18
List of unique user-agents
-
./pma2/0.1 libwww-perl/5.805
Aghaven/Nutch-1.2
Baiduspider+(+http://www.baidu.com/search/spider.htm)
BlackBerry9000/4.6.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102 ips-agent
BlackBerry9330/5.0.0.857 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/105
EMail Exractor
Gigabot/3.0 (http://www.gigablast.com/spider.html)
Gimmie60/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11)
Googlebot-Image/1.0
require "json"
require "digest"
require "logger"
class SlowQueryLogger
def initialize(output = nil, opts = {})
# will log any query slower than 500 ms
@threshold = opts.fetch(:threshold, "500").to_i
@logger = Logger.new(output || STDOUT)
@sosedoff
sosedoff / opentable_client.rb
Last active September 15, 2020 14:46
OpenTable API Client - Visit http://opentable.herokuapp.com for details
require "faraday"
require "faraday_middleware"
module OpenTable
class Error < StandardError ; end
module Request
API_BASE = "http://opentable.herokuapp.com"
def connection
#!/bin/bash
charspool=('a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p'
'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y' 'z' '0' '1' '2' '3' '4' '5' '6' '7'
'8' '9' '0' 'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H' 'I' 'J' 'K' 'L' 'M' 'N' 'O'
'P' 'Q' 'R' 'S' 'T' 'U' 'V' 'W' 'X' 'Y' 'Z' '-' '_');
len=${#charspool[*]}
if [ $# -lt 1 ]; then
@sosedoff
sosedoff / Gemfile
Created July 27, 2012 05:12
Travis build notifications for Apple Notification Center
source :rubygems
gem 'terminal-notifier'
gem 'pusher-client', :git => 'git://github.com/pusher/pusher-ruby-client.git'
Chain INPUT (policy DROP)
target prot opt source destination
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere
Chain FORWARD (policy DROP)
@sosedoff
sosedoff / simplecov_parser.rb
Last active December 26, 2015 04:39
SimpleCov html coverage file parser
require "nokogiri"
class CoverageParser
attr_reader :files,
:files_count,
:coverage_percent,
:avg_hit,
:lines_total,
:lines_relevant,
:lines_missed,
@sosedoff
sosedoff / static_server.go
Last active December 25, 2015 14:58
Static server for html development.
package main
import(
"os"
"fmt"
"net/http"
"github.com/jessevdk/go-flags"
)
type ServerOptions struct {
@sosedoff
sosedoff / gem-version.go
Last active December 25, 2015 14:49
Terminal tool to quickly check gem versions
package main
import(
"os"
"fmt"
"net/http"
"io/ioutil"
"encoding/json"
)