Skip to content

Instantly share code, notes, and snippets.

@YellowSharkMT
YellowSharkMT / pygit2.sh
Created March 12, 2014 16:53 — forked from olivier-m/pygit2.sh
Install LibGit2 & PyGit2 to a Virtual Environment (venv must be activated before executing this script). Tested on Ubuntu 12.04.4.
#!/bin/sh
set -e
if [ "${VIRTUAL_ENV}" = "" ]; then
echo "Error: Not in a virtual env"
exit 1
fi
OS=$(uname -s)
@t-mat
t-mat / Makefile-version
Created July 29, 2014 17:40
LZ4 Makefile test
## Old
##
## LIBVER_MAJOR=`sed -n '/LZ4_VERSION_MAJOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
## LIBVER_MINOR=`sed -n '/LZ4_VERSION_MINOR/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
## LIBVER_PATCH=`sed -n '/LZ4_VERSION_RELEASE/s/.*\s\+\([0-9]\+\).*/\1/p' < lz4.h`
## New
##
## (1) Need 'define ' to match only one line.
## (2) Use ' ' instead of '\s' for the compatibility. (Perhaps '[:blank:]' is better)
@smoser
smoser / lxc-clone-readme.sh
Last active December 20, 2015 21:48
Demonstrate lxc clone via overlayfs and ubuntu-cloud clone hook supporting user-data.
###
### Fast cloning with overlayfs, and specifying user-data on clone
### blog post:
### http://ubuntu-smoser.blogspot.com/2013/08/lxc-with-fast-cloning-via-overlayfs-and.html
###
### Eventually, this should make it into 13.10 and the stable lxc ppa
### https://launchpad.net/~ubuntu-lxc/+archive/stable
### But right now you'll have to use the daily ppa.

Don't use MongoDB

I've kept quiet for awhile for various political reasons, but I now feel a kind of social responsibility to deter people from banking their business on MongoDB.

Our team did serious load on MongoDB on a large (10s of millions of users, high profile company) userbase, expecting, from early good experiences, that the long-term scalability benefits touted by 10gen

@manuelvanrijn
manuelvanrijn / git-large-files.pl
Created November 10, 2011 09:36
large files in git repositories history
#!/usr/bin/perl
use 5.008;
use strict;
use Memoize;
# usage:
# git-large-files 500k
# git-large-files 0.5m
# git-large-files 5b
@codeb2cc
codeb2cc / gist:3302754
Created August 9, 2012 09:48
Sqlalchemy get_or_create implement
# -*- coding: utf-8 -*-
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import ClauseElement
def _get_or_create(session, model, defaults=None, **kwargs):
try:
query = session.query(model).filter_by(**kwargs)
instance = query.first()
@ice1000
ice1000 / C++JniGeneration.kt
Created December 20, 2016 07:33
Using Kotlin to generate JNI C++ codes for my own use
@file:JvmMultifileClass
@file:JvmName("CodeGen")
package org.algo4j.gen
import org.algo4j.test.print
/**
* Created by ice1000 on 2016/12/6.
*
@rduplain
rduplain / gist:2149194
Created March 21, 2012 16:19
PyCon 2012 Digest for WillowTree Apps

PyCon 2012 Digest

from DevOps team {rduplain,mattd,teebes}, to mobile developers at WillowTree Apps

Pronunciation

@dropwhile
dropwhile / install-setup.txt
Last active February 28, 2020 05:43
python serialization speed comparison
virtualenv --no-site-packages hodor
hodor/bin/pip install simplejson ujson cbor tnetstring msgpack-python
curl -s 'http://www.json-generator.com/api/json/get/cvfsLVmKiG?indent=2' > test.json
hodor/bin/python shootout.py