This article is now published on my website: Prefer Subshells for Context.
#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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import absolute_import | |
from time import time, sleep | |
import uuid | |
class RedisSemaphore(object): | |
""" | |
Redis base semaphore. Supports timeouts of semaphore locks. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dependencies: | |
# imagemagick | |
# swaylock | |
# grim | |
IMAGE=/tmp/i3lock.png | |
LOCK=~/.config/sway/lock.png | |
LOCKARGS="" |
OlderNewer