Skip to content

Instantly share code, notes, and snippets.

@bladelee
bladelee / export docker to lxc
Created February 23, 2014 16:21
export docker to lxc
git clone https://github.com/fabiofalci/export-docker.git
cd export-docker/
sudo curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
pip install configparser
vi export-container.py
./export-container.py eaa5715913ef mynginx
@jaytaylor
jaytaylor / dataloop_post_install.sh
Last active August 29, 2015 14:04
DataLoop ubuntu post-install cleanup script.
#!/usr/bin/env bash
set -e -x
# Shutdown the dataloop agent.
sudo service dataloop-agent stop || true
# Kill stragglers in the even that the service control didn't work right.
agentPids=$(ps -ef | grep 'dataloop-lin-agent' | grep -v 'grep' | sed 's/ \+/ /g' | cut -d' ' -f2)
test -n "${agentPids}" && sudo kill -9 ${agentPids}
@clintongormley
clintongormley / gist:1037563
Created June 21, 2011 10:06
Edge ngram example for elasticsearch
# [Tue Jun 21 12:05:39 2011] Protocol: http, Server: 192.168.5.103:9200
curl -XPUT 'http://127.0.0.1:9200/test/?pretty=1' -d '
{
"mappings" : {
"contact" : {
"properties" : {
"twitter" : {
"type" : "object",
"properties" : {
"profile" : {
@jaytaylor
jaytaylor / PlayParameterReader.scala
Created July 11, 2011 21:52
Nice ParaNameReader for the Play! Framework v.1.2.2
package PlayParameterReader
/**
* @author Jay Taylor <outtatime@gmail.com>
*
* @date 2011-05-23
*/
import scala.collection.JavaConversions._
@jaytaylor
jaytaylor / .tmux.conf
Created August 30, 2011 01:53
TMux Configuration
# Make it use C-a, similar to screen..
unbind C-b
unbind l
set -g prefix C-a
bind-key C-a last-window
# Reload key
bind r source-file ~/.tmux.conf
set -g default-terminal "screen-256color"
@jaytaylor
jaytaylor / .vimrc
Created September 20, 2011 19:14
Better Tab/Shift-Tab for block indentation
" Paste this into your .vimrc to make tab/shift-tab work on blocks of text just like in a fancy GUI IDE
map <Tab> >gb
map <S-Tab> v<gv<ESC>0I<ESC>l
imap <S-Tab> <ESC>v<gv<ESC>0I
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
@jaytaylor
jaytaylor / etc-init-gitbucket.conf
Created March 16, 2015 17:48
Gitbucket (for JAR releases from: https://github.com/takezoe/gitbucket, located in /home/ubuntu/gitbucket/gitbucker.war).
#!upstart
description "gitbucket"
env USER=ubuntu
env PID=/var/run/gitbucket.pid
env STDOUT=/var/log/gitbucket/gitbucket.log
env STDERR=/var/log/gitbucket/gitbucket.err
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
@fnichol
fnichol / README.md
Created February 5, 2012 20:50
Vagrant apt-cacher-ng

Vagrant apt-cacher-ng Box

Simple and easy, just:

mkdir apt-cacher-ng && cd apt-cacher-ng
curl -LO https://raw.github.com/gist/1747868/Vagrantfile
vagrant up

Tail the logs perhaps?

case object transaction {
import java.sql.Connection
def apply[T](query: => T):Option[T] = {
val conn:Connection = play.db.DB.getConnection
val auto:Boolean = conn.getAutoCommit
try {
conn.setAutoCommit(false)
Some(query)
} catch {
@Swind
Swind / unzip.scala
Last active April 22, 2018 08:09
[Unzip in Scala] #Scala #zip
import java.util.zip.ZipFile
import java.io.FileInputStream
import java.io.FileOutputStream
import scala.collection.JavaConversions._
import java.util.zip.ZipEntry
import java.io.InputStream
import java.io.OutputStream
import java.io.File
class ZipArchive {