Skip to content

Instantly share code, notes, and snippets.

View renta's full-sized avatar

Vasiliy Toporov renta

View GitHub Profile
@renta
renta / find_go_licenses.sh
Created October 16, 2024 08:55
Find Go module names and their licenses in the 1-st level of the directory in all Golang modules with .git folder.
#!/bin/sh
set -ex
go install github.com/google/go-licenses@latest
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && [ -d ".git" ] && [ -f "go.mod" ] && go-licenses report --include_tests --ignore gitlab.my-company.com/my-unit --ignore my-company/awesome-unit ./... >> ../licenses.csv 2> /dev/null" \;
sort licenses.csv > licenses_sort.csv && rm -f licenses.csv && mv licenses_sort.csv licenses.csv
uniq licenses.csv > licenses_uniq.csv && rm -f licenses.csv && mv licenses_uniq.csv licenses.csv
@renta
renta / gwt_token_extractor.go
Last active May 19, 2021 20:53
Gin framework JWT token extractor middleware
package gin
import (
"crypto/rsa"
"net/http"
"github.com/gin-gonic/gin"
"github.com/lestrrat-go/jwx/jwa"
"github.com/lestrrat-go/jwx/jwt"
)
@renta
renta / OrSearchFilter.php
Last active August 19, 2021 17:39
Custom OR filter for an Api Platform
<?php
namespace App\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractContextAwareFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
use Doctrine\ORM\QueryBuilder;
final class OrSearchFilter extends AbstractContextAwareFilter
{