Skip to content

Instantly share code, notes, and snippets.

View Vrael's full-sized avatar

Fran Burgos Vrael

View GitHub Profile
@Vrael
Vrael / main.dart
Created October 22, 2022 15:22 — forked from sldsrg/main.dart
Download created in memory text file (flutter for web)
import 'dart:convert';
import 'dart:html' as html;
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
class ResourceAccessKeycloakWebFilter(
private val authzClient: AuthzClient
) : WebFilter {
private val logger: Logger = LoggerFactory.getLogger(ResourceAccessKeycloakWebFilter::class.java)
override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
return getCurrentUserToken().flatMap {
logger.debug("Evaluate authorization of ${exchange.request.path} for user: ${it.getUsername()}")
try {
@Vrael
Vrael / Filters.kt
Created November 5, 2020 12:53
Spring Cloud Gateway filter for SPAs nested routes would be redirected to index.html and resolve them properly.
@Component
class SPAGatewayFilter : GatewayFilter {
val logger: Logger = LoggerFactory.getLogger(SPAGatewayFilter::class.java)
companion object { const val INDEX_PATH = "/index.html" }
override fun filter(exchange: ServerWebExchange, chain: GatewayFilterChain): Mono<Void> {
val req = exchange.request
val ex = if(req.headers.accept.contains(MediaType.TEXT_HTML)) {
exchange.mutate().request {
logger.debug("Replace path: ${req.path} by $INDEX_PATH")
@Vrael
Vrael / assets_taxonomy.cypher
Created August 11, 2020 07:31
Assets taxonomy
CREATE
(a:Asset { name: 'Asset'}),
(p:Process { name: 'Process'}),
(pa:Process { name: 'Business Process'}),
(s:Service { name: 'Service'}),
(sa:Service { name: 'IT Service'}),
(app:Application { name: 'Application'}),
(appca:Application { name: 'Customer Application'}),
// Declare a tasks that depends on other
tasks.register("hello") {
project.exec {
commandLine("cmd", "/c", "echo", "hello")
}
dependsOn(tasks["bootRun"])
}
@Vrael
Vrael / git_history.txt
Created May 26, 2020 15:14
Remove directory from Git history
# Check repo size
git count-objects -vH
# List files by size
$ git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | cut -c 1-12,41- | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
# Remove node_modules directory
git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch node_modules/' --prune-empty --tag-name-filter cat -- --all
# Update references