Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Matt Farmer farmdawgnation

:shipit:
View GitHub Profile
View keybase.md

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
Scripts in use for my personal CV19 Dashboards
View load_csvs.sql
# 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 Apr 9, 2018
Example using Logback in Java
View Example.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");
}
}
View SerializerExample.scala
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 Jul 13, 2017
Session resource registry example
View sessionresource.scala
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 Mar 7, 2017
Docker compose file for Leadership Macon development
View docker-compose.yml
version: '2'
services:
mysql:
image: mysql:5.7.17
environment:
MYSQL_ROOT_PASSWORD: "PICKAROOTPASSWORD"
wordpress:
image: wordpress:latest
View BetterSingletonSerializer.scala
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 Nov 29, 2016
Some models for testing JSON serialization/deserialization
View Models.scala
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 Aug 14, 2016
Ansible playbook for configuring my blog
View blog.yaml
---
- 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
View docker-compose.yml
version: 2
myservice:
image: ubuntu:15.10
environment:
- DOCKER_TLS_VERIFY
- DOCKER_HOST
- DOCKER_CERT_PATH