Skip to content

Instantly share code, notes, and snippets.

View farmdawgnation's full-sized avatar
:shipit:

Matt Farmer farmdawgnation

:shipit:
View GitHub Profile

Keybase proof

I hereby claim:

  • I am farmdawgnation on github.
  • I am farmdawgnation (https://keybase.io/farmdawgnation) on keybase.
  • I have a public key whose fingerprint is CD57 2E26 F60C 0A61 E6D8 FC72 4493 8917 D667 4D07

To claim this, I am signing this object:

@farmdawgnation
farmdawgnation / load_csvs.sql
Created May 25, 2020 17:45
Scripts in use for my personal CV19 Dashboards
# TODO: Update paths for your specific environment
SET sql_mode = '';
USE covid19_data;
TRUNCATE covidtracking_daily_raw;
LOAD DATA LOCAL INFILE '/path/to/csvs/covidtracking_daily.csv' INTO TABLE covidtracking_daily_raw FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES;
TRUNCATE covidtracking_daily;
INSERT INTO covidtracking_daily SELECT * FROM covidtracking_daily_view;
@farmdawgnation
farmdawgnation / Example.java
Created April 9, 2018 17:13
Example using Logback in Java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Example {
public static Logger logger = LoggerFactory.getLogger(BabysitterMain.class);
public static void main(String[] args) {
logger.info("Hello, world");
}
}
object MyResponseSerializer extends Serializer[Response] {
val clazz = classOf[Product]
override def deserialize(implicit formats: Formats): PartialFunction[(TypeInfo, JValue), Response] = {
case (TypeInfo(`clazz`, _), serializedProduct) =>
(serializedProduct \ "data") match {
case JArray(fields) =>
val datas = fields.map(_.extract[Data])
Response(datas)
@farmdawgnation
farmdawgnation / sessionresource.scala
Created July 13, 2017 16:13
Session resource registry example
object SessionResourceRegistry {
/** map of session id's to closeables */
private[this] val resources: ConcurrentHashMap[String, Seq[Closeable]] = new ConcurrentHashMap();
def registerResource(sessionId: String, resource: Closeable): Unit = {
// add the resource to the hash map
}
def onSessionShutdown(session: LiftSession): Unit = {
val sessionId = session.uniqueId
@farmdawgnation
farmdawgnation / docker-compose.yml
Last active March 7, 2017 14:46
Docker compose file for Leadership Macon development
version: '2'
services:
mysql:
image: mysql:5.7.17
environment:
MYSQL_ROOT_PASSWORD: "PICKAROOTPASSWORD"
wordpress:
image: wordpress:latest
import scala.collection._
import org.json4s._
object SingletonSerializer extends Serializer[Any] {
private[this] var memoizedSingletons: mutable.Map[(Class[_], String), Any] = mutable.Map.empty
private def isValidSingleton(clazz: Class[_], classIdentifier: String) = {
if (memoizedSingletons.contains((clazz, classIdentifier))) {
true
} else if (classIdentifier.endsWith("$")) {
@farmdawgnation
farmdawgnation / Models.scala
Last active November 29, 2016 19:09
Some models for testing JSON serialization/deserialization
package me.frmr.json
import java.util.Date
case class Person(name: String, occupation: String, moneyInTheBank: Double)
sealed trait Resource
sealed trait Employee extends Resource
case class FullTimeEmployee(name: String, title: String, startDate: String, salary: Long) extends Employee
@farmdawgnation
farmdawgnation / blog.yaml
Created August 14, 2016 15:15
Ansible playbook for configuring my blog
---
- hosts: blog
tasks:
- name: Ensure ghost folder exists
file: path=/fdn/ghost owner=root group=root state=directory mode="u=rwx,g=rwx,o=rwx"
become: yes
become_method: sudo
version: 2
myservice:
image: ubuntu:15.10
environment:
- DOCKER_TLS_VERIFY
- DOCKER_HOST
- DOCKER_CERT_PATH