Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🐦

Stratos Gerakakis stratosgear

💭
🐦
View GitHub Profile
@singulared
singulared / sway-lock.sh
Created Feb 12, 2020
swaylock with image per-output
View sway-lock.sh
#!/bin/bash
# Dependencies:
# imagemagick
# swaylock
# grim
IMAGE=/tmp/i3lock.png
LOCK=~/.config/sway/lock.png
LOCKARGS=""
@kekru
kekru / traefik-redirect-path.md
Last active May 17, 2022
Traefik redirect / (root) to sub path with Docker labels
View traefik-redirect-path.md

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:
Goals

  • https://example.com -> https://example.com/abc/xyz/
  • https://example.com/ -> https://example.com/abc/xyz/
  • https://example.com/something -> no redirect
@mattbennett
mattbennett / client.py
Created Apr 14, 2017
Nameko Auth Toy
View client.py
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:
@lkrone
lkrone / ean13-label-sheet.py
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.
View ean13-label-sheet.py
#!/usr/bin/env python3
from reportlab.lib.pagesizes import A4
from reportlab.graphics.shapes import Drawing, String
from reportlab.graphics.barcode.eanbc import Ean13BarcodeWidget
from reportlab.graphics import renderPDF
from reportlab.pdfgen.canvas import Canvas
"""
Adjust pagesize, number of labels, barcode size and
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active May 12, 2022
A comparison of using `git flow` commands versus raw `git` commands.
View gitflow-breakdown.md

Initialize

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

Connect to the remote repository

@cdiener
cdiener / asciinator.py
Created Apr 13, 2014
asciinator.py now with documentation
View asciinator.py
# 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
@jhorman
jhorman / redis_semaphore.py
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.
View redis_semaphore.py
from __future__ import absolute_import
from time import time, sleep
import uuid
class RedisSemaphore(object):
"""
Redis base semaphore. Supports timeouts of semaphore locks.
"""
@DaRaFF
DaRaFF / ubuntu-php-development-environment.md
Last active Sep 26, 2021
Ubuntu php development environment
View ubuntu-php-development-environment.md

#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: https://github.com/mheiniger/webdev-setup

@datagrok
datagrok / gist:2199506
Last active Sep 8, 2021
Virtualenv's `bin/activate` is Doing It Wrong
View gist:2199506