Skip to content

Instantly share code, notes, and snippets.

View charlieegan3's full-sized avatar
🥑
avocado

Charlie Egan charlieegan3

🥑
avocado
View GitHub Profile
@charlieegan3
charlieegan3 / twitter.rb
Created October 8, 2014 16:14
Data on Twitter Subscriptions
require 'twitter'
TWITTER_CONSUMER_KEY = 'xxxx'
TWITTER_CONSUMER_SECRET = 'xxxx'
USERNAME = 'username'
FRIEND_COUNT = 200 #Max 200, I think.
TWEET_COUNT = 50
START_INDEX = 68 #if you hit the rate limit start where you left off
twitter_client = Twitter::REST::Client.new do |config|
def sorted_dup_hash(array)
Hash[*array.inject(Hash.new(0)) { |h,e| h[e] += 1; h }.
select { |k,v| v > 1 }.inject({}) { |r, e| r[e.first] = e.last; r }.
sort_by {|_,v| v}.reverse.flatten]
end
@charlieegan3
charlieegan3 / global_cast.rb
Created December 1, 2013 22:46
A simple script to process a list of films to find the most common cast members.
require 'badfruit'
require 'guess'
require 'sexmachine'
d = SexMachine::Detector.new
bf = BadFruit.new("YOUR_RT_API_KEY")
movies = ["Hunger Games: Catching Fire","Gravity", "..." ]
total = movies.size.to_s
@charlieegan3
charlieegan3 / question1.elm
Last active April 22, 2016 08:03
Elm: 99 questions
-- q1: myLast
import Html exposing (text)
myLast : List a -> Result String a
myLast list =
Result.fromMaybe ("Can't get head of empty.")
<| List.head
<| List.reverse list
main =
@charlieegan3
charlieegan3 / question01.fs
Last active April 23, 2016 22:40
F#: 99 questions
// question 1
// Last element of a list
exception ListEmptyError of string
let last xs =
match xs with
|[] -> raise (ListEmptyError("List is empty"))
|x -> x |> List.rev |> List.head
[<EntryPoint>]
require 'json'
require 'open-uri'
require 'pry'
urls = []
Dir.glob("general/*.json") do |f|
list = JSON.parse(File.open(f).read)
urls += list.select do |e|
e["file"] && e["file"]["filetype"].match(/jpg/)
end.map { |e| e["file"]["url_private_download"] }
//: Playground - noun: a place where people can play
import Darwin
import Foundation
enum Result<T> {
case Ok(T)
case Err(String)
}

Installing clamAV on OSX 10.11 using homebrew

brew install clamav
freshclam -v
vi /usr/local/etc/clamav/clamd.conf
# add line LocalSocket /tmp/clamd.socket
./usr/local/Cellar/clamav/0.99.2_1/sbin/clamd --config-file=/usr/local/etc/clamav/clamd.conf
ps aux | grep clam
### Keybase proof
I hereby claim:
* I am charlieegan3 on github.
* I am charlieegan3 (https://keybase.io/charlieegan3) on keybase.
* I have a public key whose fingerprint is 3DA9 3090 84D0 D854 FE09 8588 DB86 FF2D 25A9 6313
To claim this, I am signing this object:
[{"from":{"lat":"51.502500","lon":"-0.278126","name":"Acton Town"},"to":{"lat":"51.517675","lon":"-0.0824580","name":"Liverpool Street"},"time":46.05,"legs":5},{"from":{"lat":"51.50856013","lon":"-0.262879534","name":"Acton Central"},"to":{"lat":"51.517675","lon":"-0.0824580","name":"Liverpool Street"},"time":52.65,"legs":3},{"from":{"lat":"51.51394","lon":"-0.07537","name":"Aldgate"},"to":{"lat":"51.517675","lon":"-0.0824580","name":"Liverpool Street"},"time":7.483333333333333,"legs":3},{"from":{"lat":"51.51514","lon":"-0.07178","name":"Aldgate East"},"to":{"lat":"51.517675","lon":"-0.0824580","name":"Liverpool Street"},"time":10.8,"legs":3},{"from":{"lat":"51.54097","lon":"-0.30061","name":"Alperton"},"to":{"lat":"51.517675","lon":"-0.0824580","name":"Liverpool Street"},"time":56.25,"legs":3},{"from":{"lat":"51.67435","lon":"-0.60732","name":"Amersham"},"to":{"lat":"51.517675","lon":"-0.0824580","name":"Liverpool Street"},"time":75.75,"legs":5},{"from":{"lat":"51.53253","lon":"-0.10579","name":"Angel"},"to"