Skip to content

Instantly share code, notes, and snippets.

View WRonX's full-sized avatar

WRonX WRonX

View GitHub Profile
@WRonX
WRonX / laravel_schedule.md
Created January 11, 2023 13:09
Running Laravel scheduler on Azure environment

Introduction

This is just an add-on to running queue worker on Azure. If you want to run scheduler, first you need to get familiar with that document and fullfill the environment file update requirement for Supervisor (in the document above it's done by adding EnvGenerate command and running it on startup). After that, you need to create Supervisor configuration and run it on startup.

⚠️ This is a very poorly tested solution and the stability of it is currently unknown. Use at your own risk.
⚠️ ALSO: this instruction was created for a very specific case, yours is probably different.
⚠️ ALSO ALSO: Laravel's documentation does not encourage running schedule worker on production environments, it rather suggests it was created for local development environments. From my experience it seems to work the same as schedule:run ran

@WRonX
WRonX / azure_queues.md
Last active January 11, 2023 12:54
Running Laravel queue worker on Azure environment

Introduction

Deploying PHP applications on Azure environments is possible, but makes not much of a sense. Main reason is a number of limitations, especially when you are used to solutions like Heroku.

One of the limitations is the lack of easily achieved background queue workers. Running queue:work as startup command will crash your deployment slot, Azure WebJobs will not work on Linux instances and Windows instances have only PHP 7.something as stack. Your options are limited and this is one of them, very hacky and workaround-like, but worth testing.

⚠️ This is a very poorly tested solution and the stability of it is currently unknown. Use at your own risk.
⚠️ ALSO: this instruction was created for a very specific case, yours is probably different.

Explanation

@WRonX
WRonX / slacker.py
Last active November 24, 2022 14:36
Learning Python: a script for activating Slack after some idle period (on Windows).
import time
import pyautogui as gui
import win32api
from pygetwindow._pygetwindow_win import Win32Window
def getIdleSeconds():
return int((win32api.GetTickCount() - win32api.GetLastInputInfo()) / 1000.0)
@WRonX
WRonX / genenv.sh
Created September 30, 2022 12:19
Shell script to export prefixed environment variables to JSON file
#!/bin/bash
ENV_FILE="env.json"
ENV_PREFIX="REACT_APP_"
shopt -s lastpipe
FOUND=0
echo '{' > $ENV_FILE