Skip to content

Instantly share code, notes, and snippets.

View ferrerojosh's full-sized avatar

John Joshua Ferrer ferrerojosh

View GitHub Profile

Run (Unix):

git -c rebase.instructionFormat='%s%nexec GIT_AUTHOR_DATE="%ai" GIT_COMMITTER_DATE="%ci" git commit --amend --no-edit --reset-author' rebase -r --root

Run (Windows):

git -c rebase.instructionFormat="%s%nexec GIT_AUTHOR_DATE="""%ai""" GIT_COMMITTER_DATE="""%ci""" git commit --amend --no-edit --reset-author" rebase -r --root
ferrerojosh / application.yml
Created March 3, 2020 10:28
Keycloak AuthZ Policy Enforcer Spring Boot Configuration
port: 3000
main.banner-mode: OFF
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}
username: ${DB_USER}
password: ${DB_PASS}
ferrerojosh / keycloak.provider.ts
Last active July 10, 2023 20:03
Keycloak v9.0.0 NestJS Resource Guard
import { FactoryProvider, Logger } from '@nestjs/common';
import Keycloak from 'keycloak-connect';
export const keycloakProvider: FactoryProvider = {
useFactory: () => {
const keycloakConfig: any = {
realm: '',
ferrerojosh / R2DBCIO.kt
Last active February 16, 2024 18:06
Simple r2dbc client wrapper using kotlin coroutines
import io.r2dbc.spi.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.reactive.awaitFirst
import kotlinx.coroutines.reactive.awaitFirstOrNull
import kotlin.reflect.KClass
* An R2DBC client that uses Kotlin coroutines.
ferrerojosh / LICENSE
Last active March 20, 2019 18:40
Copyright (c) $today.year Author
This software is conditionally proprietary. As long as this notice
is attached, you will not in any verbatim modify, or release the
software without permission from the author.
If you think the software is worth it, you may send an entire bag two
kilograms minimum of chocolates (in mass) to each personnel that
ferrerojosh / ARCH_INSTALL.MD
Created June 11, 2018 06:08 — forked from yabbes/ARCH_INSTALL.MD
Installing Arch with GPT, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync

Boot from USB and set prepare system

loadkeys <your-keymap>
ferrerojosh /
Created June 9, 2018 17:14 — forked from cryzed/
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!


Results after following the guide as of 11.01.2017 13:08:

ferrerojosh / AndroidWorkerInjection.kt
Created May 30, 2018 06:40
androidx workmanager injector temporary impl
object AndroidWorkerInjection {
fun inject(worker: Worker) {
checkNotNull(worker, { "worker" })
val application = worker.applicationContext
if (application !is HasWorkerInjector) {
throw RuntimeException("${application.javaClass.canonicalName} does not implement ${}")
ferrerojosh / MyFragment.kt
Last active April 19, 2018 06:27
Random material color
class MyFragment : Fragment() {
private fun randomMaterialColor(typeColor: String): Int {
var returnColor = Color.GRAY
val arrayId = resources.getIdentifier("mdcolor_$typeColor", "array", activity!!.packageName)
if (arrayId != 0) {
val colors = resources.obtainTypedArray(arrayId)
val index = (Math.random() * colors.length()).toInt()
returnColor = colors.getColor(index, Color.GRAY)
ferrerojosh / md-sidenav-splitter.directive.ts
Last active June 8, 2017 05:14
A quick splitter control for angular material sidenav for Angular 2/4
import { AfterViewInit, ContentChild, Directive, ElementRef, Input, Renderer2 } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { MdSidenav } from '@angular/material';
selector: '[mdSidenavSplitter]'
export class MdSidenavSplitterDirective implements AfterViewInit {
@ContentChild(MdSidenav, {read: ElementRef}) sidenavRef: ElementRef;
@Input() splitterWidth = 10;