Skip to content

Instantly share code, notes, and snippets.

View amscotti's full-sized avatar
😀

Anthony Scotti amscotti

😀
View GitHub Profile
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"
}
}
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
hello = fn(text) ->
fn(name) ->
"#{text} #{name}"
end
end.("Hello")
IO.inspect hello.("World") # "Hello World"
IO.inspect Enum.reduce(Enum.filter(1..999,fn(x) -> rem(x, 3) == 0 || rem(x, 5) == 0 end), 0, &1+&2)
@amscotti
amscotti / factorial.exs
Created September 29, 2013 02:03
Example of pattern matching in Elixir
defmodule Factorial do
def of(0), do: 1
def of(n), do: n * of(n-1)
end
IO.inspect Factorial.of(4)
@amscotti
amscotti / functions.coffee
Last active December 20, 2015 05:09
Syntax comparison of Functions using CoffeeScript, Dart, and TypeScript.
divisible = 3
divisibleReporter = (lastFound, nextDivisible) ->
"Found: #{lastFound}, Next: #{nextDivisible}"
divisibleKeeper = ((divisible) ->
lastFound = 0
nextDivisible = divisible
(number) ->
if (number >= nextDivisible)
@amscotti
amscotti / DocWho.coffee
Last active December 19, 2015 13:19
Syntax comparison of Classes and Inheritance using CoffeeScript, Dart, and TypeScript.
class Character
@name
constructor: (person, @role) ->
@name = "#{person.firstname} #{person.lastname}"
toString: () ->
"#{@role} played by #{@name}"
@Grab(group='org.ccil.cowan.tagsoup', module='tagsoup', version='1.2' )
def tagsoupParser = new org.ccil.cowan.tagsoup.Parser()
def slurper = new XmlSlurper(tagsoupParser)
def url = "http://www.nfl.com/stats/categorystats?archive=false&conference=null&statisticCategory=PASSING&season=2010&seasonType=REG&amp;experience=null&tabSeq=0&qualified=true&Submit=Go"
def htmlParser = slurper.parse(url)
tabledata = htmlParser.'**'.find { it.@class == 'data-table1' }.tbody.tr.collect {
[
Rk: it.td[0].text().trim(),
Player: it.td[1].text().trim(),
#!/usr/local/bin/python
#Used to make snapshot of all the file systems on a zpool.
import commands
import subprocess
import time
import os
timestamp = time.strftime("%Y%m%d-%H%M")