Skip to content

Instantly share code, notes, and snippets.

View hrvoj3e's full-sized avatar
💻
Cloning ...

Hrvoje hrvoj3e

💻
Cloning ...
View GitHub Profile
openapi: 3.0.2
info:
title: demo
version: 1.0.0
description: ''
paths:
/demo:
get:
parameters:
- in: query
@hrvoj3e
hrvoj3e / nginx-location-example.conf
Last active February 24, 2022 10:22
tusd subfolder deploy
location /my-subfolder/ {
# Forward incoming requests to local tusd instance
proxy_pass http://192.168.54.111:8472/;
proxy_redirect ~/files/(.*)$ $scheme://$host/my-subfolder/files/$1;
# Disable request and response buffering
proxy_request_buffering off;
proxy_buffering off;
proxy_http_version 1.1;
@hrvoj3e
hrvoj3e / AuthServiceProvider.php
Created February 8, 2022 11:26 — forked from paulofreitas/AuthServiceProvider.php
Extending the default Eloquent User Provider (Laravel 5.4+)
<?php
namespace App\Providers;
use App\Auth\UserProvider;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
@hrvoj3e
hrvoj3e / nginx.conf
Created August 19, 2020 06:23 — forked from sgomez84/nginx.conf
Nginx Proxy Pass to PHP-FPM
upstream phpfpm {
#server unix:/var/run/php5-fpm.sock;
#avoid sockets for nginx-fpm on Linux, they are good for BSD
server 127.0.0.1:9000;
}
server {
listen 8080;
server_name sumhr.com;
rewrite ^(.*) $scheme://www.sumhr.com$1 permanent;
@hrvoj3e
hrvoj3e / ubuntu-1804-lacp-bonding.md
Created March 9, 2020 16:45 — forked from PhilipSchmid/ubuntu-1804-lacp-bonding.md
Ubuntu 18.04 LACP Network Interface Bonding

Interface bonding

Configure an LACP active network interface bonding on Ubuntu 18.04 using netplan:

root@srv01:~# mv /etc/netplan/50-cloud-init.yaml /etc/netplan/01-netcfg.yaml
root@srv01:~# cat /etc/netplan/01-netcfg.yaml 
network:
    version: 2
    renderer: networkd
 ethernets:
@hrvoj3e
hrvoj3e / docker-compose.yml
Created February 27, 2020 16:39 — forked from iki/docker-compose.yml
Docker-compose nginx CORS proxy
version: '3.7'
services:
whoami:
image: jwilder/whoami
ports:
- 127.0.0.1:7000:8000
cors:
<?php
namespace Core\UserBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class SecurityController extends Controller
{
public function loginAction(Request $request)
@hrvoj3e
hrvoj3e / jwt-expiration.md
Created December 31, 2019 15:20 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@hrvoj3e
hrvoj3e / keybase.md
Created October 24, 2019 18:16
keybase.md

Keybase proof

I hereby claim:

  • I am hrvoj3e on github.
  • I am hrvoj3e (https://keybase.io/hrvoj3e) on keybase.
  • I have a public key ASCouDrOYVr7vbfxwRQatfK00eIaLr07bFnUYfPSHn131Ao

To claim this, I am signing this object:

@hrvoj3e
hrvoj3e / semver.sh
Created October 10, 2019 19:13 — forked from Ariel-Rodriguez/semver.sh
semver compare tool in bash
#!/bin/bash
###
# semantic version comparition using semver specification http://semver.org/
# This bash script compares pre-releases alphabetically as well
#
# returns 1 when A greater than B
# returns 0 when A equals B
# returns -1 when A lower than B
#