Skip to content

Instantly share code, notes, and snippets.

version: '2'
services:
go:
image: giftig/go:latest
volumes:
- ${DATA_DIR}:/usr/src/db
go_static:
image: giftig/go-static:latest
@giftig
giftig / batching.sc
Last active December 27, 2018 09:51
import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.util.Random
// Demo how to page through and group up matching rows in a source like a slick table, writing
// to some sink before proceeding to the next batch. Handles issues like matching entries being
// astride the boundary of pages or there being enough rows to group that it exceeds your standard
// page size
//
#!/usr/bin/env python2.7
import codecs
import sys
from xml.dom import minidom
filename = '/dev/stdin'
if len(sys.argv) > 1:
filename = sys.argv[1]
#!/bin/bash
QF_TYPE='files'
ACK_FLAGS='--scala --python'
while [[ "$1" != '' ]]; do
case "$1" in
-d|--def|--definition)
shift
QF_TYPE='def'
import datetime
import string
class DateParser(object):
"""Parse various convenient date phrases"""
DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
@staticmethod
def _parse_timedelta(n, unit):
@giftig
giftig / prettify.py
Created March 27, 2017 14:58
Simple mixins for colourising statements and giving colourised command handling
import logging
import optparse
class ColourMixin(object):
"""Mix this into classes to provide nice colourised text support"""
_default_colours = {
'red': '\033[31m',
'green': '\033[32m',
'yellow': '\033[33m',
#!/bin/bash
java -jar build/realmclicker-0.2.jar -i 100ms -r 25ms -p 1s -d 25s
@giftig
giftig / gist:6e75ac678a27af99c93b
Last active August 29, 2015 14:15
Error wth fedup
WARNING: problems were encountered during transaction test:
broken dependencies
perl-PlRPC-0.2020-13.fc19.noarch requires perl-4:5.16.3-266.fc19.x86_64
kmod-nvidia-3.11.8-200.fc19.x86_64-1:331.67-1.fc19.x86_64 requires kernel-3.11.7-200.fc19.x86_64, kernel-3.11.8-200.fc19.x86_64, kernel-3.14.23-100.fc19.x86_64
Continue with the upgrade at your own risk.
scala> val hmm: Option[String] = Some("lala")
scala> hmm collect {{
| case rawr if rawr == "lala" => rawr * 2
| }: PartialFunction[String, String]}
res2: Option[String] = Some(lalalala)
scala> res2 ++ List("teehee")
res3: Iterable[String] = List(lalalala, teehee)
scala> hmm collect {{
scala> val hmm: Option[String] = Some("lala")
scala> hmm collect {{
| case rawr if rawr == "lala" => rawr * 2
| }: PartialFunction[String, String]}
res2: Option[String] = Some(lalalala)
scala> res2 ++ List("teehee")
res3: Iterable[String] = List(lalalala, teehee)
scala> hmm collect {{