Skip to content

Instantly share code, notes, and snippets.

View heyman's full-sized avatar

Jonatan Heyman heyman

View GitHub Profile
@heyman
heyman / geventmongo.py
Created November 16, 2011 09:47 — forked from gwik/geventmongo.py
PyMongo >=2.0 pool for gevent
# Copyright 2011 10gen
#
# Modified by Antonin Amand <[email protected]> to work with gevent.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@heyman
heyman / s3botostorage.py
Created August 9, 2012 11:31 — forked from tbarbugli/s3botostorage.py
S3BotoStorage
from boto.utils import parse_ts
from django.core.files.storage import get_storage_class
from storages.backends.s3boto import S3BotoStorage
"""
make sure you have this setting
AWS_PRELOAD_METADATA = True
and that you have python-dateutils==1.5 installed
"""
@heyman
heyman / gist:3744010
Created September 18, 2012 16:12
Generic Django JSON view class with JSONP support
try:
import simplejson as json
except ImportError:
import json
from django.views import generic
from django.http import HttpResponse
class JsonView(generic.View):
"""
#!/usr/bin/env bash
# set terminal to UTF8 (otherwise `gem install foreman` fails)
export LANG=en_CA.UTF-8
# set up ruby env
mkdir ruby-gems
echo $HOME
echo `pwd`
export GEM_HOME=$HOME/.ruby-gems
@heyman
heyman / locustfile.py
Created July 2, 2013 17:33
Hack to monkey patch in the old Locust HTTP client into the current locust version (0.6.2)
from locust import Locust, TaskSet, task
import old_client
old_client.patch()
class MyTasks(TaskSet):
@task
def index(self):
self.client.get("/")
@heyman
heyman / gist:95ee0df663b2d4b9d6fb
Last active October 30, 2019 18:47
Installing Locust on Ubuntu 14.04
sudo apt-get update
sudo apt-get install -y python-pip
sudo apt-get install -y python-dev
sudo apt-get install -y libzmq-dev
sudo pip install virtualenv
virtualenv venv
source venv/bin/activate
pip install locustio
pip install pyzmq
@heyman
heyman / gist:eec08ec0ed81df205e83
Created December 4, 2014 14:38
Django TemplateView with support for returning HttpResponse in get_context_data()
from django.http import HttpResponse
from django.views import generic
class TemplateView(generic.TemplateView):
"""
Exactly like Django's TemplateView, but adds support for returning an
HttpResponse in get_context_data
"""
def get(self, request, *args, **kwargs):
context_or_response = self.get_context_data(**kwargs)
@heyman
heyman / gist:1e1ab8b2d1eddfc6434c
Last active October 7, 2024 13:20
Greece GeoJSON
{
"type": "MultiPolygon",
"coordinates": [
[
[
[
23.699980096133004,
35.70500438083553
],
[
#!/bin/bash
touch /tmp/Recent.xyz
while true
do
echo "Checking again..."
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/InRelease -O /tmp/InRelease.xyz
if test /tmp/InRelease.xyz -nt Recent.xyz; then
say Docker timestamp updated!
@heyman
heyman / autoexec.cfg
Last active May 11, 2017 19:21
CS:GO config
// jonatans superconfig
net_graph 1
//muzzleflash_light 0
cl_forcepreload 1
rate "128000"
cl_updaterate 128
cl_cmdrate 128
// crosshair