Skip to content

Instantly share code, notes, and snippets.

View stratosgear's full-sized avatar
🥥

Stratos Gerakakis stratosgear

🥥
View GitHub Profile
@singulared
singulared / sway-lock.sh
Created February 12, 2020 15:37
swaylock with image per-output
#!/bin/bash
# Dependencies:
# imagemagick
# swaylock
# grim
IMAGE=/tmp/i3lock.png
LOCK=~/.config/sway/lock.png
LOCKARGS=""
@nilayk
nilayk / Google Ad Highlighter.user.js
Last active March 24, 2023 20:07
Tampermonkey Script - Google Ad Highlighter
// ==UserScript==
// @name Google Ad Highlighter
// @namespace https://gist.github.com/nilayk/ca6dd5b15f958efb5d2e20c3caca3a9f/
// @version 1.1
// @description Highlight Google Ads in search results
// @author Nilay Khandelwal
// @include *google.com/search*
// @downloadURL https://gist.githubusercontent.com/nilayk/ca6dd5b15f958efb5d2e20c3caca3a9f/raw/Google%2520Ad%2520Highlighter.user.js
// @grant GM_addStyle
// ==/UserScript==
@kekru
kekru / traefik-redirect-path.md
Last active October 16, 2024 09:52
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:
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 April 14, 2017 15:00
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:
@lkrone
lkrone / ean13-label-sheet.py
Created December 16, 2016 22:43
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 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 November 5, 2024 15:51
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

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 April 13, 2014 03:11
asciinator.py 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
@jhorman
jhorman / redis_semaphore.py
Last active September 19, 2024 11:57
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.
"""
@DaRaFF
DaRaFF / ubuntu-php-development-environment.md
Last active October 13, 2023 00:16
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: https://github.com/mheiniger/webdev-setup

@datagrok
datagrok / gist:2199506
Last active August 22, 2024 14:21
Virtualenv's `bin/activate` is Doing It Wrong