Skip to content

Instantly share code, notes, and snippets.

View amscotti's full-sized avatar
😀

Anthony Scotti amscotti

😀
View GitHub Profile
let firstUnique (word: string): char option =
word
|> Seq.countBy id
|> Seq.filter (snd >> (=) 1)
|> Seq.map fst
|> Seq.tryHead
[<EntryPoint>]
let main argv =
match argv |> Seq.tryHead |> Option.bind firstUnique with

Keybase proof

I hereby claim:

  • I am amscotti on github.
  • I am amscotti (https://keybase.io/amscotti) on keybase.
  • I have a public key whose fingerprint is B980 9D6D 9B8A 9322 8739 9BB9 6762 7C86 CC38 D6A7

To claim this, I am signing this object:

def realm = URLEncoder.encode("Staghelm")
def guild = URLEncoder.encode("Controlled Chaos")
def url = "http://www.wowarmory.com/guild-info.xml?r=${realm}&amp;n=${guild}".toURL()
def types = [
"1": "Warrior", "2": "Paladin", "3": "Hunter",
"4": "Rogue", "5": "Priest", "6": "Death Knight",
"7": "Shaman", "8": "Mage", "9": "Warlock",
"11": "Druid"].withDefault { key -> "unknown" }
require 'net/http'
require 'rexml/document'
include REXML
def get_xml_page(strRealm, strGuildName)
oresp = Net::HTTP.start( "www.wowarmory.com") do |http|
http.get( "/guild-info.xml?r=#{strRealm}&amp;n=#{strGuildName}",
{ 'user-agent' =&gt; 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-GB; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4'})
end
listofemails = new File("email_list.txt").text
listofemails.eachLine { it ->
def respons = new XmlSlurper().parseText(new URL("http://www.stopforumspam.com/api?email=${it}").text)
if (respons.appears.text() == "yes") {
println "${it} has been reported ${respons.frequency.text()} times on stopforumspam.com"
}
}
input {
generator {
lines => [
"2017-02-12 14:50:98 DEBUG Main:12 - Test log file",
"2017-02-12 14:51:98 INFO Main:13 - Test log file",
"2017-02-12 14:52:98 WARN Main:14 - Test log file",
"2017-02-12 14:53:98 ERROR Main:15 - Test log file",
"2017-02-12 14:54:98 FATAL Main:16 - Test log file"
]
add_field => { "service" => "a" }
image: amscotti/jekyll-build
pipelines:
default:
- step:
script:
- bundle exec jekyll build
branches:
master:
- step:
FROM alpine:3.2
MAINTAINER Anthony Scotti <anthony.m.scotti@gmail.com>
# Install base packages
RUN apk update
RUN apk upgrade
RUN apk add curl tar ca-certificates bash build-base libffi-dev
RUN curl -Ls https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.21-r2/glibc-2.21-r2.apk > /tmp/glibc-2.21-r2.apk
RUN apk add --allow-untrusted /tmp/glibc-2.21-r2.apk
# This is a sample build configuration for Ruby.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: ruby:2.1.7
pipelines:
default:
- step:
@amscotti
amscotti / client.rb
Created August 31, 2014 19:42
RPC using Redis
require 'redis'
require 'securerandom'
require 'msgpack'
class RedisRpcClient
def initialize(redis_url, list_name)
@client = Redis.connect(url: redis_url)
@list_name = list_name.to_s
end