Skip to content

Instantly share code, notes, and snippets.

Avatar

Seb Vetter roadsideseb

  • Roadside Software & Adventures
  • Squamish, BC
View GitHub Profile
@roadsideseb
roadsideseb / async_schedule.py
Last active May 13, 2021
A slightly modified version of the 'schedule' Python package that works with asyncio 😎
View async_schedule.py
import emoji
import schedule
import asyncio
import inspect
from datetime import datetime
class Job(schedule.Job):
@roadsideseb
roadsideseb / xvfb-run.sh
Last active Jun 15, 2019 — forked from tyleramos/xvfb-run.sh
XVFB Run Bash script
View xvfb-run.sh
#!/bin/sh
# $Id: xvfb-run 2027 2004-11-16 14:54:16Z branden $
# This script starts an instance of Xvfb, the "fake" X server, runs a command
# with that server available, and kills the X server when done. The return
# value of the command becomes the return value of this script, except in cases
# where this script encounters an error.
#
# If anyone is using this to build a Debian package, make sure the package
@roadsideseb
roadsideseb / edit.py
Created Apr 9, 2013
MultiFormView for handling multiple forms in a Django CBV with a little more ease...
View edit.py
"""
The following mixins and views are borrowed and adapted from the following
gist:
https://gist.github.com/michelts/1029336
"""
from functools import partial
from django.views.generic.base import TemplateResponseMixin
from django.views.generic.edit import ProcessFormView, FormMixin
@roadsideseb
roadsideseb / python_job_sites.md
Last active Apr 4, 2018
Job sites for Django and Python developers
View python_job_sites.md
@roadsideseb
roadsideseb / views.py
Created Jan 30, 2014
Packing slips for Oscar using PISA in the dashboard
View views.py
from xhtml2pdf import pisa
from xhtml2pdf.pdf import pisaPDF
class OrderListView(ListView, BulkEditMixin):
...
actions = (
'generate_packing_slips',
...
@roadsideseb
roadsideseb / docker_run.sh
Created Mar 16, 2015
Start a container on elastic beanstalk with the full configuration provided in the deployment script(s).
View docker_run.sh
#!/usr/bin/env bash
set -e
. /opt/elasticbeanstalk/hooks/common.sh
# switch to current app directory
cd $EB_CONFIG_APP_CURRENT
# Dockerrun.aws.json can override settings in Dockerfile
echo "Reading settings from Dockerrun.aws.json"
@roadsideseb
roadsideseb / base.html
Created Feb 2, 2014
Oscar packing slip / invoice templates using pisa.
View base.html
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
@page {
size: a4 portrait;
margin: 1cm;
margin-left:2cm;
margin-right:2cm;
@roadsideseb
roadsideseb / docker_commands.sh
Last active Jul 17, 2017
A few handy Docker commands
View docker_commands.sh
# Delete all stopped containers
docker rm $(docker ps -a -q)
# Remove unused, dangling images
docker rmi $(docker images -q -f dangling=true)
# Remove all but X images with a specific name (old image cleanup),
# in this case, we leave the 2 newest images.
$(docker images | grep my-docker-image | tail -n+3 | awk '{ print $1":"$2; }')
View pipoa
#!/bin/bash
set -ex
pip_args=${@:-"--help"}
apk add --no-cache \
--virtual .build-deps \
gcc \
g++ \
make \
@roadsideseb
roadsideseb / 01 🐍 load testing with gatling.md
Last active Jan 12, 2017
Load testing Python web apps with Gatling
View 01 🐍 load testing with gatling.md

Results

These results are generated by a gatling simulation that ramps 100 user over 10 second and then keeps the users constant at that rate for 60 seconds before ramping again by 100 users. The entire scenario runs from 0 to 1000 users.

Flask