Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Cloning ...

hrvoj3e

💻
Cloning ...
View GitHub Profile
@hrvoj3e
hrvoj3e / AuthServiceProvider.php
Created Feb 8, 2022 — forked from paulofreitas/AuthServiceProvider.php
Extending the default Eloquent User Provider (Laravel 5.4+)
View AuthServiceProvider.php
<?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 Aug 19, 2020 — forked from sgomez84/nginx.conf
Nginx Proxy Pass to PHP-FPM
View nginx.conf
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 Mar 9, 2020 — forked from PhilipSchmid/ubuntu-1804-lacp-bonding.md
Ubuntu 18.04 LACP Network Interface Bonding
View ubuntu-1804-lacp-bonding.md

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 Feb 27, 2020 — forked from iki/docker-compose.yml
Docker-compose nginx CORS proxy
View docker-compose.yml
version: '3.7'
services:
whoami:
image: jwilder/whoami
ports:
- 127.0.0.1:7000:8000
cors:
View Core-UserBundle-Controller-SecurityController.php
<?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 Dec 31, 2019 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?
View jwt-expiration.md

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 / semver.sh
Created Oct 10, 2019 — forked from Ariel-Rodriguez/semver.sh
semver compare tool in bash
View semver.sh
#!/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
#
View sync-using-gitignore.sh
# sync everything excluding things in .gitignore
# delete anything on target not in source
# include dotfiles and symlinks, also use compression
rsync -azP --delete --filter=":- .gitignore" . my-target-host:/my/target/directory
@hrvoj3e
hrvoj3e / db_backup.sh
Created Jan 30, 2019 — forked from bendavis78/db_backup.sh
A simple database backup / rotation / prune script
View db_backup.sh
#!/bin/bash
# for use with cron, eg:
# 0 3 * * * postgres /var/db/db_backup.sh foo_db
if [[ -z "$1" ]]; then
echo "Usage: $0 <db_name> [pg_dump args]"
exit 1
fi
@hrvoj3e
hrvoj3e / gist:030975f03f3762299cc6220914de5b0f
Created Nov 15, 2018 — forked from jaxbot/gist:5748513
Block nginx from serving .git directories
View gist:030975f03f3762299cc6220914de5b0f
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}