Skip to content

Instantly share code, notes, and snippets.

View mre's full-sized avatar
🪴
I like plants.

Matthias Endler mre

🪴
I like plants.
View GitHub Profile
@mre
mre / setuptools fix
Created January 27, 2014 23:00
Latest 'pip' fails with “requires setuptools >= 0.8 for <package>”
# I got the above error on Mavericks after upgrading Python.
# This is what I did to fix it.
# I was using virtualenv, so I first deactivated the current virtual environment
# and removed it completely
deactivate
rm -rf venv
# Then I upgraded pip to 1.5.1
brew upgrade pip
@mre
mre / gist:723d356f1dde8030a80c
Created May 13, 2014 08:43
logstash config
input {
file {
# Path to your logs
path => "/logs/*"
start_position => "beginning"
}
}
filter {
grok {
@mre
mre / redis info
Created May 22, 2014 08:27
Redis connection issues. Output of redis info
# Server
redis_version:2.8.9
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:53bb8484a594dab0
redis_mode:standalone
os:FreeBSD 9.2-RELEASE-p6 amd64
arch_bits:64
multiplexing_api:kqueue
gcc_version:4.2.1
@mre
mre / info commandstats
Created May 28, 2014 12:16
Redis commandstats
info commandstats
$1158
# Commandstats
cmdstat_get:calls=344336405,usec=1084573265,usec_per_call=3.15
cmdstat_set:calls=86516,usec=590904,usec_per_call=6.83
cmdstat_setex:calls=28000873,usec=262906699,usec_per_call=9.39
cmdstat_del:calls=4138776,usec=12168359,usec_per_call=2.94
cmdstat_exists:calls=967,usec=2135,usec_per_call=2.21
cmdstat_sadd:calls=5214906740,usec=4204169654,usec_per_call=0.81
cmdstat_srem:calls=4135644,usec=20366147,usec_per_call=4.92
# Use multirust to manage multiple Rust builds:
# 1. Install multirust
curl -sf https://raw.githubusercontent.com/brson/multirust/master/blastoff.sh | sh
# 2. Show installed Rust builds
multirust list-toolchains
# 3. Install new build (stable, beta, nightly)
multirust update nightly
@mre
mre / composer.json
Created November 4, 2015 11:24
Test development branch with composer
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/you/package.git"
}
],
"require": {
"you/package": "dev-bugfix/your-dev-branch as 1.5.x-dev"
}
@mre
mre / test_server.py
Last active December 5, 2019 10:12
How to write a unit test for BaseHTTPServer and subclasses
import threading
import time
import unittest
import urllib2
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
fn main() {
println!("Hello, world!");
}
fn make_guess(g: Game, c: char) -> Game {
let mut new_game = g;
new_game.guesses.push(c);
if !new_game.word.contains(c) {
new_game.tries_left -= 1;
}
@mre
mre / Cargo.toml
Last active August 28, 2016 18:39
[package]
name = "ease-test"
version = "0.1.0"
[dependencies]
ease = "*"
serde_json = "0.8.1"
serde_macros = "*"
serde = "*"
@mre
mre / test.rs
Created September 18, 2016 12:20
#[macro_use] extern crate nickel;
use std::collections::BTreeMap;
use nickel::status::StatusCode;
use nickel::{Nickel, JsonBody, HttpRouter, MediaType};
#[derive(Clone)]
struct Person {
first_name: String,
last_name: String,