Skip to content

Instantly share code, notes, and snippets.

View ludwigm's full-sized avatar

Michael Ludwig ludwigm

  • Netlight Consulting
  • Germany
View GitHub Profile
@casualjim
casualjim / resque.scala
Created March 17, 2011 17:40
A resque implementation in scala with akka actors and scala-redis
package com.mojolly.backchat
package redis
package resque
import com.mojolly.backchat.redis.resque.Resque.{ResqueWorkerActor}
import net.liftweb.json._
import JsonAST._
import JsonDSL._
import java.net.InetAddress
import com.redis.ds.{ RedisDeque, RedisDequeClient }
@sekimura
sekimura / text_strip_margin.py
Created May 13, 2012 04:08
Text (heredoc) strip margin in Python
import re
def strip_margin(text):
return re.sub('\n[ \t]*\|', '\n', text)
def strip_heredoc(text):
indent = len(min(re.findall('\n[ \t]*(?=\S)', text) or ['']))
pattern = r'\n[ \t]{%d}' % (indent - 1)
return re.sub(pattern, '\n', text)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 10, 2024 21:24
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@beaufour
beaufour / gzipinputstream.py
Created December 4, 2012 16:03
Python: Streaming Gzip reader
import zlib
import string
BLOCK_SIZE = 16384
"""Read block size"""
WINDOW_BUFFER_SIZE = 16 + zlib.MAX_WBITS
"""zlib window buffer size, set to gzip's format"""
@jroper
jroper / MyManagedResource.scala
Last active November 4, 2021 10:20
Play resource routing
class MyManagedResource extends ResourceController[String] {
def index = Action(Ok("index"))
def newScreen = Action(Ok("new"))
def create = Action {
Redirect(MyInjectableResource.reverseRoutes.index())
}
def show(id: String) = Action(Ok("Show " + id))
@jeantil
jeantil / Application.scala
Last active July 29, 2018 12:01
Playframework 2.2 configurable cors filter
/**
The MIT License (MIT)
Copyright (c) 2013 Jean Helou
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@relaxdiego
relaxdiego / graphite.md
Last active January 5, 2022 09:07 — forked from surjikal/graphite.md
Installing Graphite in OS X Mavericks

Follow these steps to install graphite on OS X Mavericks.

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Install dependencies

Install Cairo and friends

@krishnanraman
krishnanraman / r in scala.txt
Last active October 2, 2020 00:00
Using R from Scala
Step 0. You must have the latest & greatest version of R, and scala 2.10.1, for all of this to work.
Step 1. Download and unzip the MacOS X Binary jvmr_1.0.4.tgz from here: http://cran.r-project.org/web/packages/jvmr/index.html
Step 2. Create a lib folder, and copy jvmr_2.10-1.0.4.jar to that folder.
Step 3. Start R
Step 4. At the R console
>install.packages("jvmr")
@torkildr
torkildr / chromelight.py
Created January 28, 2014 09:13
Quick hack to make make Philips Hue light bulbs dim down when using Chromecast (or, more specifically, when certain apps are open).
#!/usr/bin/env python
import os
import requests
import libxml2
import time
import phue
import daemon
import lockfile
import signal
@jonikarppinen
jonikarppinen / markdown-comments.md
Last active April 21, 2024 23:44
How to comment out stuff in Markdown on GitHub?

Comments in GitHub flavour of Markdown

As answers to this Stack Overflow question reveal, using <!--- and ---> or <!-- and --> works (view source by clicking "Raw"):