Skip to content

Instantly share code, notes, and snippets.

View ecasilla's full-sized avatar
🏠
Working from home

Ernie Casilla ecasilla

🏠
Working from home
  • This Crust Planet
  • Washington,DC
View GitHub Profile
@ecasilla
ecasilla / README-fail2ban-keycloak.md
Created October 19, 2021 17:38 — forked from thomasdarimont/README-fail2ban-keycloak.md
Use fail2ban to block brute-force attacks to keycloak server. #keycloak #fail2ban #brute-force-attack

Add regular-expression filter under /etc/fail2ban/filter.d/keycloak.conf:

[INCLUDES]

before = common.conf

[Definition]

_threadName = [a-z][-_0-9a-z]*(\s[a-z][-_0-9a-z]*)*
_userId = (null|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})
@ecasilla
ecasilla / DynamicOtpFormAuthenticator.java
Created October 19, 2021 14:15 — forked from thomasdarimont/DynamicOtpFormAuthenticator.java
Dynamic OTP Validation support for Keycloak 1.7.x
package org.keycloak.authentication.authenticators.browser;
import org.keycloak.authentication.AuthenticationFlowContext;
import org.keycloak.models.*;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import java.util.*;
import java.util.regex.Pattern;
@ecasilla
ecasilla / private_fork.md
Created July 15, 2020 04:23 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

const input = {
x: 'hello world',
y: 2,
f: true,
z: {
a: [1,2,3],
b: new Set([1,2,3]),
c: new Map([['hello', 'world']]),
d: null,
e: undefined
@ecasilla
ecasilla / cloudSettings
Last active July 15, 2019 16:05
Vscode Settings
{"lastUpload":"2019-07-15T16:05:26.337Z","extensionVersion":"v3.4.0"}

Keybase proof

I hereby claim:

  • I am ecasilla on github.
  • I am erniecasilla (https://keybase.io/erniecasilla) on keybase.
  • I have a public key ASBdSB8vESShvzF51b1dUXUPp_bNN7VQcjAYgjHKsr_Pkgo

To claim this, I am signing this object:

@ecasilla
ecasilla / extract.js
Created May 14, 2016 22:21
Extract Github Issues Lables
// eg https://github.com/cssnext/cssnext/labels
// paste this script in your console
// copy the output and now you can import it using https://github.com/ecasilla/github-labelmaker !
var labels = [].slice.call(document.querySelectorAll(".label-link"))
.map(function(ele) {
return {
name: ele.textContent.trim(),
# -*- mode: ruby -*-
# # vi: set ft=ruby :
require 'fileutils'
Vagrant.require_version ">= 1.6.0"
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data")
CONFIG = File.join(File.dirname(__FILE__), "config.rb")
@ecasilla
ecasilla / calculator.js
Created September 22, 2015 03:38
Awesome Calculator
function Calculator() {}
function reduceArgs(operation) {
return function() {
var args = Array.prototype.slice.call(arguments);
var ops = {
'+': function(x, y) {
return x + y;
},
'-': function(x, y) {
@ecasilla
ecasilla / tools.js
Created August 25, 2015 16:45
Node js prod tools
var heapdump = require('heapdump');
//Grab a heapdump if the memory increase goes over 250mb
var nextMBThreshold = 0;
setInterval(function () {
var memoryMB = process.memoryUsage().rss / 1048576;
if (memoryMB > nextMBThreshold) {
heapdump.writeSnapshot();
nextMBThreshold += 250;
}