Skip to content

Instantly share code, notes, and snippets.

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

Francisco Jiménez Cabrera jkfran

🏠
Working from home
View GitHub Profile
@jkfran
jkfran / list-aks-outbound-ips.sh
Created November 4, 2024 13:59
This Bash script retrieves all Azure Kubernetes Service (AKS) clusters in your subscription and lists their associated outbound IP addresses. It helps in auditing and monitoring the outbound IP configurations for your AKS clusters.
#!/bin/bash
az aks list --query '[].{Name:name, ResourceGroup:resourceGroup}' -o tsv | while IFS=$'\t' read -r name rg; do
# Check if both name and resource group are non-empty
if [[ -n "$name" && -n "$rg" ]]; then
ip_ids=$(az aks show --resource-group "$rg" --name "$name" --query 'networkProfile.loadBalancerProfile.effectiveOutboundIPs[].id' -o tsv)
# Check if ip_ids is non-empty
if [[ -n "$ip_ids" ]]; then
for ip_id in $ip_ids; do
@jkfran
jkfran / Analysis_of_Algorithms_Mind_Map.md
Created October 27, 2024 13:36
Mind Map: Analysis of Algorithms Overview

Analysis of Algorithms Mind Map

Overview

This mind map provides a structured overview of Analysis of Algorithms, covering key concepts such as Complexity Analysis, Performance Measures, Growth Rates, Case Analysis, and Applications in Data Structures.

Analysis_of_Algorithms_Mind_Map

Mermaid Diagram

To view the mind map as a Mermaid diagram, use a Mermaid-compatible Markdown viewer or plugin:

@jkfran
jkfran / ubuntu-sleep.yaml
Created July 27, 2023 12:47 — forked from tcdowney/ubuntu-sleep.yaml
Ubuntu Sleep Pod
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
labels:
app: ubuntu
spec:
containers:
- image: ubuntu
command:
@jkfran
jkfran / langchain-with-service-account.py
Created May 23, 2023 15:08
LangChain + Google Drive using service account (Using an Environment variable instead of a file)
import os
import json
import tempfile
from langchain.document_loaders import GoogleDriveLoader
# Load service account key from environment variable
service_account_data = json.loads(os.getenv("GOOGLE_SERVICE_ACCOUNT"))
# Create a temporary file and write the service account data to it
with tempfile.NamedTemporaryFile(mode="w+", suffix=".json", delete=False) as temp_file:
@jkfran
jkfran / twitter-muted-words.txt
Created December 20, 2022 10:45
Twitter - List of muted words by jkfran
bitcoin
Britney Spears
catalan
catalonia
cataluña
catalunya
coronavirus
COVID
covid-19
covid19
@jkfran
jkfran / import-github-labels.js
Last active July 31, 2020 12:53 — forked from Isaddo/import-github-labels.js
import github labels via console command
/*
Go on your labels page (https://github.com/user/repo/labels)
Edit the following label array
or
Use this snippet to export github labels (https://gist.github.com/MoOx/93c2853fee760f42d97f)
and replace it
Paste this script in your console
Press Enter!!
@jkfran
jkfran / export-github-labels.js
Last active March 24, 2020 17:25 — forked from MoOx/index.js
Export/import github labels
// go on you labels pages
// 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/popomore/github-labels !
var labels = [];
[].slice.call(document.querySelectorAll(".js-label-link"))
.forEach(function(element) {
labels.push({
name: element.textContent.trim(),
@jkfran
jkfran / qa-templates-checker.sh
Created November 19, 2019 17:36
QA Jinja2 templates changes
#! /usr/bin/env bash
# Bash strict mode
set -euo pipefail
# Remove older log file
if [[ -f ./diff.log ]]; then
rm ./diff.log
fi
@jkfran
jkfran / Scroll to the end for infinite scroll.js
Created November 29, 2017 11:02
Paste this code in javascript console to scroll to the end.
function scrollToBottom(){
bottom = document.body.scrollHeight;
current = window.innerHeight+ document.body.scrollTop;
if((bottom-current) >0){
window.scrollTo(0, bottom);
setTimeout ('scrollToBottom()', 1000);
}
};
scrollToBottom();
@jkfran
jkfran / controlwindows.py
Last active November 16, 2017 21:16
This is a simple script to move between windows sorted by creation. Useful for keyboard shorcuts. I personally use it to move through the windows on xfce-panel
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This is a simple script to move between windows sorted by creation.
Useful for keyboard shorcuts. I personally use it to move through the
windows on xfce-panel. Usage: ./controlwindows.py up/down
Dependecies: wmctrl, xdotool and xprop"""
import subprocess
import sys