Skip to content

Instantly share code, notes, and snippets.


Stratos Gerakakis stratosgear

View GitHub Profile
datagrok / gist:2199506
Last active Jun 21, 2022
Virtualenv's `bin/activate` is Doing It Wrong
View gist:2199506
DaRaFF /
Last active Sep 26, 2021
Ubuntu php development environment

#Introduction If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with php. This is for a developer machine and not for a live environment!

I hope it helps you too!

fyi @mheiniger and me started with an installer here:

jhorman /
Last active Apr 13, 2022
Redis semaphore implemented in Python via zsets. Lock expiration is implemented by only scanning the zset for items within a time range.
from __future__ import absolute_import
from time import time, sleep
import uuid
class RedisSemaphore(object):
Redis base semaphore. Supports timeouts of semaphore locks.
cdiener /
Created Apr 13, 2014 now with documentation
# This line imports the modules we will need. The first is the sys module used
# to read the command line arguments. Second the Python Imaging Library to read
# the image and third numpy, a linear algebra/vector/matrix module.
import sys; from PIL import Image; import numpy as np
# This is a list of characters from low to high "blackness" in order to map the
# intensities of the image to ascii characters
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@'))
# Check whether all necessary command line arguments were given, if not exit and show a
JamesMGreene /
Last active Aug 16, 2022
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.


gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

lkrone /
Created Dec 16, 2016
Shows a way to generate a PDF (with Python and ReportLab) of a sheet of labels containing EAN-13 Barcodes and a short, descriptive text.
#!/usr/bin/env python3
from reportlab.lib.pagesizes import A4
from import Drawing, String
from import Ean13BarcodeWidget
from import renderPDF
from reportlab.pdfgen.canvas import Canvas
Adjust pagesize, number of labels, barcode size and
mattbennett /
Created Apr 14, 2017
Nameko Auth Toy
from nameko.standalone.rpc import ClusterRpcProxy
config = {
'AMQP_URI': 'amqp://guest:guest@localhost:5672/'
with ClusterRpcProxy(config) as rpc:
session_token = rpc.auth.login("admin", "secret")
with ClusterRpcProxy(config, context_data={'session': session_token}) as rpc:
kekru /
Last active Aug 2, 2022
Traefik redirect / (root) to sub path with Docker labels

Traefik: redirect base or root path to a subpath

This is tested with Traefik 1.7

This is how to redirect the root or base path to a sub path in Traefik using Docker labels:

  • ->
  • ->
  • -> no redirect
singulared /
Created Feb 12, 2020
swaylock with image per-output
# Dependencies:
# imagemagick
# swaylock
# grim