Skip to content

Instantly share code, notes, and snippets.

Avatar
🥑
avocado

Charlie Egan charlieegan3

🥑
avocado
View GitHub Profile
View 1_download_film_data.rb
require "open-uri"
require "csv"
require "nokogiri"
require "pry"
csv_string = CSV.generate do |csv|
# this is the max number of pages with data on the-numbers.com
(1..5401).step(100).each do |page|
puts page
doc = Nokogiri::HTML(open("http://www.the-numbers.com/movie/budgets/all/#{page}").read)
@charlieegan3
charlieegan3 / report.sh
Created Nov 10, 2020
Script to download data about the volume of resources in a cluster
View report.sh
#!/usr/bin/env bash
set -eo pipefail
OUTPUT_DIR=output
mkdir -p $OUTPUT_DIR
resources=($(kubectl api-resources | tail -n +2 | awk '{ print $1 }'))
ignore=("bindings" "tokenreviews" "localsubjectaccessreviews" "selfsubjectaccessreviews" "selfsubjectrulesreviews" "subjectaccessreviews")
View semver_compare.rego
package semver_compare
is_greater_or_equal(a, b) = result {
result := {
is_greater(a, b),
is_equal(a, b),
} & { true } == { true }
}
is_lesser_or_equal(a, b) = result {
result := {
View dropbox_content_hash.go
package dropbox
import (
"crypto/sha256"
"fmt"
"os"
"github.com/pkg/errors"
)
View each.sh
#!/usr/bin/env bash
# run safe_flatten for each in folder
set -eo pipefail
root_dir=$1
if [ -z "$root_dir" ]
then
View client.rb
require 'socket'
socket = TCPSocket.new('0.0.0.0', 3000)
socket.write("hey")
p socket.recv(100)
@charlieegan3
charlieegan3 / urls.go
Last active Aug 17, 2017
url parsing fun
View urls.go
func main() {
// let's parse some youarells
url1, _ := url.Parse("http://www.example.com")
url2, _ := url.Parse("www.example.com")
// oops, this the second one needs a scheme, let's set one:
url2.Scheme = "http"
// perfect - now my urls are the same
fmt.Println(url1.String()) // => http://www.example.com
View main.go
package main
import (
"bytes"
"fmt"
"math/rand"
"os"
"os/exec"
"strconv"
"strings"
@charlieegan3
charlieegan3 / task.rb
Created Mar 6, 2017
github issue watcher
View task.rb
# intended for heroku daily scheduler
require "open-uri"
require "json"
require "pushover"
require "pry"
repos = {
"user/repo" => "tag"
@charlieegan3
charlieegan3 / Dockerfile
Created Jan 21, 2017
Dockerfile to run the coreNLP server.
View Dockerfile
FROM java:8
RUN curl http://nlp.stanford.edu/software/stanford-corenlp-full-2015-12-09.zip > corenlp.zip
RUN unzip corenlp.zip -d /corenlp
RUN mv /corenlp/*/* /corenlp
WORKDIR /corenlp
RUN export CLASSPATH="`find . -name '*.jar'`"
EXPOSE 9000
CMD java -cp "*" -mx4g edu.stanford.nlp.pipeline.StanfordCoreNLPServer