Skip to content

Instantly share code, notes, and snippets.

@J4si3k
J4si3k / useMachine.ts
Created September 17, 2022 08:55 — forked from darrenjennings/useMachine.ts
vue useMachine.ts
import { StateMachine, interpret, EventObject } from '@xstate/fsm'
import { ref, Ref, onBeforeMount } from '@vue/composition-api'
export default function useMachine<TContext, TEvent extends EventObject = EventObject> (
stateMachine: StateMachine.Machine<TContext, TEvent, any>): {
current: Ref<StateMachine.State<TContext, TEvent, any>>,
send: StateMachine.Service<TContext, TEvent>['send'],
service: StateMachine.Service<TContext, TEvent>,
} {
const current = ref(stateMachine.initialState) as Ref<StateMachine.State<TContext, TEvent, any>>
@programmeruser2
programmeruser2 / jwt.js
Last active May 31, 2022 09:15
Decode JWT
const decodeJwt = token => token.split('.').map((item,index) => index==2?item:JSON.parse(atob(item)));
const encodeJwt = segments => segments.map((item,index)=>index==2?item:btoa(JSON.stringify(item))).join('.');
@juriansluiman
juriansluiman / docker-compose.yml
Last active February 26, 2023 17:35
Traefik 2.2 with openvpn failover with udp+tcp protocol
version: '3'
networks:
web:
external: true
bridge:
external: true
services:
traefik:
@stancl
stancl / deploy.sh
Last active September 16, 2024 02:39
Deploy using GitHub actions and SSH to a VPS
#!/bin/sh
set -e
vendor/bin/phpunit
npm run prod
git add .
(git commit -m "Build frontend assets for deployment to production") || true
(git push) || true
@darrenjennings
darrenjennings / useMachine.ts
Created January 19, 2020 00:17
vue useMachine.ts
import { StateMachine, interpret, EventObject } from '@xstate/fsm'
import { ref, Ref, onBeforeMount } from '@vue/composition-api'
export default function useMachine<TContext, TEvent extends EventObject = EventObject> (
stateMachine: StateMachine.Machine<TContext, TEvent, any>): {
current: Ref<StateMachine.State<TContext, TEvent, any>>,
send: StateMachine.Service<TContext, TEvent>['send'],
service: StateMachine.Service<TContext, TEvent>,
} {
const current = ref(stateMachine.initialState) as Ref<StateMachine.State<TContext, TEvent, any>>
@Mau5Machine
Mau5Machine / docker-compose.yml
Last active July 4, 2024 16:57
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always
@fatihyildizhan
fatihyildizhan / Docker 23 + Traefik 2.9.10 and v1.7 + Let's Encrypt + Github Registry V2 ghcr.io + Updated on 12 April 2023
Last active August 29, 2024 13:19
Docker 23 + Traefik 2.9.10 and v1.7 + Let's Encrypt + Github Registry V2 ghcr.io + Updated on 12 April 2023
Docker 23 + Traefik v2.9.10 and v1.7 + Let's Encrypt + Github Registry V2 ghcr.io + Updated on 12 April 2023
Content:
- Ubuntu 22.04
- Docker Engine 23.0.3
- Docker Compose 2.17.2
- Traefik v1.7.18 with dnsChallenge
- Traefik v2.9.9 with httpChallenge
--
- Github Registry V2 ghcr.io
@darth-veitcher
darth-veitcher / docker-compose.yaml
Created September 9, 2019 13:26
Traefik v2.0 with Cloudflare Wildcard and OpenVPN
version: "3"
services:
traefik:
image: "traefik:v2.0"
container_name: "traefik"
command:
# Globals
- "--log.level=DEBUG"
- "--api=true"
#Reference: https://www.smarthomebeginner.com/traefik-reverse-proxy-tutorial-for-docker
#Requirement: nano .env -> Set environmental variables: ${$USERDIR}, ${PUID}, ${PGID}, ${TZ}, ${DOMAINNAME}, ${CLOUDFLARE_EMAIL}, ${CLOUDFLARE_API_KEY}, ${HTTP_USERNAME}, ${HTTP_PASSWORD}, ${PLEX_CLAIM} etc. as explained in the reference.
version: "3.7"
services:
######### FRONTENDS ##########
# Traefik Reverse Proxy
traefik:
@AmirFayaz
AmirFayaz / RequestBeautifier.php
Last active May 15, 2021 09:35
A Middleware for Laravel/Lumen, Which "Trims" Requests, Removes "White Spaces" and Converts "Persian/Arabic Numbers to English Ones"
<?php
namespace App\Http\Middleware;
use Closure;
class RequestBeautifier
{
protected $except = [
'password',