Skip to content

Instantly share code, notes, and snippets.

View go up
version: '2'
services:
go:
image: giftig/go:latest
volumes:
- ${DATA_DIR}:/usr/src/db
go_static:
image: giftig/go-static:latest
View batching.sc
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
//
View format_xml.py
#!/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]
View quickfind
#!/bin/bash
QF_TYPE='files'
ACK_FLAGS='--scala --python'
while [[ "$1" != '' ]]; do
case "$1" in
-d|--def|--definition)
shift
QF_TYPE='def'
View util.py
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 Mar 27, 2017
Simple mixins for colourising statements and giving colourised command handling
View prettify.py
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',
View gist:f86cc6d3424398fdd90a
#!/bin/bash
java -jar build/realmclicker-0.2.jar -i 100ms -r 25ms -p 1s -d 25s
View gist:6e75ac678a27af99c93b
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.
View hmmm.scala
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 {{
View gist:db182b372daa11b34437
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 {{
You can’t perform that action at this time.