Skip to content

Instantly share code, notes, and snippets.

View dacort's full-sized avatar
🤔
Thinking about some new idea...

Damon P. Cortesi dacort

🤔
Thinking about some new idea...
View GitHub Profile
@dacort
dacort / gist:770242
Created January 7, 2011 22:46
#BSidesSF Poem
Twas the night before #BSidesSF, when all through the tubes
Not a hacker was stirring, not even the newbs;
@dacort
dacort / leavenotifications.rb
Created June 14, 2011 17:56
Twitter Mass Notification Disable
client = Grackle::Client.new(:auth => {
:type => :oauth,
:consumer_key => CONSUMER_KEY, :consumer_secret => CONSUMER_SECRET,
:token => TOKEN, :token_secret => TOKEN_SECRET
})
users = []
(client.friends.ids?).each_slice(100) do |uids|
users |= (client.users.lookup? :user_id => uids.join(','))
end
package main
import (
"encoding/json"
"fmt"
)
var jsonStr = []byte(`
{
"things": [

Keybase proof

I hereby claim:

  • I am dacort on github.
  • I am dacort (https://keybase.io/dacort) on keybase.
  • I have a public key whose fingerprint is 0931 E57B 9A91 8338 5B93 201B F594 2FCD 9F8D 1C6D

To claim this, I am signing this object:

@dacort
dacort / cookiemonster.go
Created September 23, 2014 06:51
Simple script to extract (encrypted) cookies out of Chrome OS X cookie store. Usage: ./cookiemonster domain.com
package main
import (
"code.google.com/p/go.crypto/pbkdf2"
"crypto/aes"
"crypto/cipher"
"crypto/sha1"
"database/sql"
"fmt"
"log"
@dacort
dacort / gist:f480bb3b99817dbbefdb
Created April 23, 2015 06:19
Extract Github URL counts from Chrome history
sqlite3 ~/Library/Application\ Support/Google/Chrome/Default/History "SELECT date(visit_time/1000000-11644473600, 'unixepoch'),urls.url,count(*) FROM visits INNER JOIN urls ON visits.url = urls.id WHERE urls.url LIKE '%github.com/%' GROUP BY date(visit_time/1000000-11644473600, 'unixepoch'),urls.url ORDER BY date(visit_time/1000000-11644473600, 'unixepoch') DESC,count(*);"
#!/bin/sh
#
#
# Poor man's version. Good 'ol bash and shell commands.
# Initialize stat counters
COPIES=0
FROM_APPS=()
TO_APPS=()
import sys
import boto3
from slacker import Slacker
import ConfigParser
import csv
from datetime import datetime
reload(sys)
sys.setdefaultencoding('utf8')
@dacort
dacort / ctas_update.md
Created July 22, 2019 16:17
Athena CTAS Update

Athena CTAS Update

An approach for updating partitions in an existing table using CTAS queries.

Overview

With the release of CTAS functionality for Athena, you're now able to create derivative tables in Athena with different data formats or S3 locations.

Sometimes, though, you want to be able to add data to a partition of an existing table. As long as that partition doesn't already exist, you can do this with Athena by using CTAS with a temporary table.

@dacort
dacort / Dockerfile
Created August 19, 2021 22:48
Using Anaconda for Spark dependencies on EMR on EKS
FROM 895885662937.dkr.ecr.us-west-2.amazonaws.com/spark/emr-6.3.0:latest
### Switch to root for installation
USER root
### setup for conda
RUN yum install -y wget
### Install Conda into shared location
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \