Skip to content

Instantly share code, notes, and snippets.

Thinking about some new idea...

Damon P. Cortesi dacort

Thinking about some new idea...
View GitHub Profile
dacort /
Created Jul 22, 2019
Athena CTAS Update

Athena CTAS Update

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


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.

import sys
import boto3
from slacker import Slacker
import ConfigParser
import csv
from datetime import datetime
# Poor man's version. Good 'ol bash and shell commands.
# Initialize stat counters
dacort / gist:f480bb3b99817dbbefdb
Created Apr 23, 2015
Extract Github URL counts from Chrome history
View gist:f480bb3b99817dbbefdb
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 = WHERE urls.url LIKE '' GROUP BY date(visit_time/1000000-11644473600, 'unixepoch'),urls.url ORDER BY date(visit_time/1000000-11644473600, 'unixepoch') DESC,count(*);"
dacort / cookiemonster.go
Created Sep 23, 2014
Simple script to extract (encrypted) cookies out of Chrome OS X cookie store. Usage: ./cookiemonster
View cookiemonster.go
package main
import (

Keybase proof

I hereby claim:

  • I am dacort on github.
  • I am 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:

View multiple_types.go
package main
import (
var jsonStr = []byte(`
"things": [
dacort / leavenotifications.rb
Created Jun 14, 2011
Twitter Mass Notification Disable
View leavenotifications.rb
client = => {
: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(','))
View gist:770242
Twas the night before #BSidesSF, when all through the tubes
Not a hacker was stirring, not even the newbs;
View launchmas.txt
Twas the night before launch, when all through the server
Not a process was stirring, not even a crawler;
The init scripts were stored in rc.d,
In hopes that the sys admin soon would be free;
The Damon was nestled all snug in his bed,
While visions of multi-tenant architecture danced in his head;
And nginx all configured, and cap deploy at the ready,
You can’t perform that action at this time.