Skip to content

Instantly share code, notes, and snippets.

View NekoTashi's full-sized avatar

Christopher Rubio Márquez NekoTashi

View GitHub Profile
@NekoTashi
NekoTashi / .md
Created April 28, 2026 14:23
Keycloak: Block Access at the Client Level

Block Access at the Client Level

This is a Keycloak-side solution — you configure Keycloak itself to reject the token request for a specific user on a specific client, before your app even sees the token.

The advantage over app-side checks is that the user never gets a token at all.


How it Works

Keycloak SPI -- License Manager via Microsoft Graph

The SPI writes licenses to Microsoft. On every login/register/profile update, it reads the user's desired licenses from a Keycloak attribute and enforces them in Entra ID.

dotacion-worker (4am cron)
  → creates/updates user in Keycloak
  → sets attribute "ms_licenses" = "skuId1,skuId2"

User logs in
This file has been truncated, but you can view the full file.
{
"lighthouseVersion": "10.4.0",
"requestedUrl": "https://www.falabella.com/falabella-cl",
"mainDocumentUrl": "https://www.falabella.com/falabella-cl",
"finalDisplayedUrl": "https://www.falabella.com/falabella-cl",
"finalUrl": "https://www.falabella.com/falabella-cl",
"fetchTime": "2023-07-28T00:55:24.386Z",
"gatherMode": "navigation",
"runWarnings": [],
@NekoTashi
NekoTashi / fields.md
Last active June 30, 2021 18:33
item-fields
field type detail
code_chain string En blanco
sku int ID Unico
name string Descripcion del SKU
description string Descripcion del SKU
short_description string Existe Campo pero no manejos datos en él, lo enviaremos en Blanco
category1 string codigo del Grupo
description_category1 string Descripcion del grupo
category2 string codigo del subgrupo
@NekoTashi
NekoTashi / notes.md
Last active April 16, 2019 18:15
Instance Group GCP
  • gcloud compute ssh qmatch-web-capture-scraper-5 --project miin-vps --zone us-east1-c
  • sudo su
  • su - ldiaz
  • pm2 start <file.js>
  • pm2 logs
  • pm2 stop <file.js>
  • pm2 delete <id|name>
  • qmatch-web-capture-selectors-img-001
@NekoTashi
NekoTashi / notas.md
Created November 22, 2018 18:26
ArrayReferenceField
title Using Djongo Array Reference Field
permalink /using-django-with-mongodb-array-reference-field/

Array Reference field

The ArrayReferenceField is one of the most powerful features of Djongo. The ArrayModelField stores the embedded models within a MongoDB array as embedded documents for each entry. If entries contain duplicate embedded documents, using the ArrayModelField would require unnecessary disk space. The ManyToManyField on the other hand has a separate table for all the entries. In addition, it also creates an intermediate "through/join" table which records all the mappings.

The ArrayReferenceField is a bargain between the ArrayModelField and ManyToManyField. A separate collection is used for storing all entries (instead of embedding it as an array). This means there is no data duplication. However, the intermediate "through/join" mapping table is completely skipped! This is achieved by storing only a reference to the entries in the embedded array.

@NekoTashi
NekoTashi / activate_venv.sh
Created October 12, 2018 14:54
How to activate venv inside a bash script.
#!/bin/sh
set -e
cd "<virtualenv_dir>"
source bin/activate
# -- Your code here!
@NekoTashi
NekoTashi / notas.md
Last active April 21, 2018 20:21
Proyecto Hugo Forms.

Notas

  • Mostrar el MS del server con 3 estados: rojo, amarillo, verde. Al presionar es elemento, que se muestre la explicación de cada uno de los colores.
  • Choice es un input que puede tener como dependecia otros inputs.

Convenciones

  • Form: Conjunto de inputs.
  • Input: Elemento que contiene un dato.
@NekoTashi
NekoTashi / leap_year.py
Created January 3, 2018 15:10
365 does not include leap year.
from datetime import datetime, timedelta
PYBITES_BORN = datetime(year=2016, month=12, day=19)
def my_gen_special_pybites_dates():
days = 1
while True:
dt = PYBITES_BORN + timedelta(days=days)
# if days % 100 == 0: # commented to print only 'every year'