Skip to content

Instantly share code, notes, and snippets.

View heyman's full-sized avatar

Jonatan Heyman heyman

View GitHub Profile
@heyman
heyman / locust_manual_report.py
Last active May 4, 2020 21:38
Context manager / Decorator for adding manual Locust stats entries
"""
Usage examples:
# As context manager:
with manual_report("stats_entry_name"):
# do stuff
# As a decorator for tasks:
@task
@manual_report
@heyman
heyman / iptables-docker-ufw.sh
Created September 6, 2018 13:11 — forked from rubot/docker_ufw_setup.sh
easy fix for DOCKER-USER and ufw
# Solves the problem with open ports with docker and ufw
# As Docker uses the nat table, the filter table FORWARD chain is used and does not touch ufw-input chains as expected.
# Even for ufw-forward chains it would not work, as DOCKER chains are inserted in front.
# This is a simple fix that worked for me.
INTERFACE_NAME=eth0
__clear(){
sed -i '/^# dockerfix start/,/^# dockerfix end/d' $1
@heyman
heyman / keybase.md
Last active October 18, 2017 12:45
keybase.md

Keybase proof

I hereby claim:

  • I am heyman on github.
  • I am heyman (https://keybase.io/heyman) on keybase.
  • I have a public key ASBayfWFGjb5lwUu5Y1eSdD8lp8qOa57aH8Ei0NfyhmOtQo

To claim this, I am signing this object:

@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
#!/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 / gist:1e1ab8b2d1eddfc6434c
Last active March 1, 2016 09:44
Greece GeoJSON
{
"type": "MultiPolygon",
"coordinates": [
[
[
[
23.699980096133004,
35.70500438083553
],
[
@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: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 / 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("/")
#!/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