Skip to content

Instantly share code, notes, and snippets.

View colemanja91's full-sized avatar
🏠
Working from home

Allie Coleman colemanja91

🏠
Working from home
View GitHub Profile
@danmayer
danmayer / RailsCookieDebugging.rb
Created August 14, 2019 18:56
Debugging Growing Cookies and Cookie Overflows
####
# This can be inserted in a before filter, or an endpoint causing cookie overflows
# this will log data for users who are approaching the max_cookie_size
# it will also for the most common cookie to overflow session, break down the size by key value pairs.
# This logs cookie and key names, but none of the data which may include PII, it just logs the byte sizes
#
# How to read:
# Cookie Debug (size: 3280) # overall cookies total size in bytes
# [COOKIE_NAME] size=IN_BYTES # these are sorted by smallest to largest byte size
# session: [KEY] size=IN_BYTES # for the session cookie, the key name with values in byte size sorted
@jmrr
jmrr / mysql2parquet.scala
Last active June 23, 2022 20:04
MySQL tables to parquet files on the Spark shell
val sqlContext = new org.apache.spark.sql.SQLContext(sc) // optional
val df = sqlContext.load("jdbc", Map(
"url" -> "jdbc:mysql://<ip.address.your.db>/<table>?user=<username>&password=<pwd>",
"dbtable" -> "<tablename>"))
df.select("<col1>","<col2>","<col3>").save("</path/to/parquet/file.parquet>","parquet")
//Alternatively, to save all the columns: