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 / 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
@jkfran
jkfran / aeat_verified_NIF.php
Created May 3, 2017 10:08
Comprobar validez de NIF y Nombre con la Agencia Tributaria
<?php
/**
* Previamente convertir ceritificado .p12 o pfx a .key.pem y .crt.pem:
*
* openssl pkcs12 -in ciar.pfx -out cia.key.pem -nocerts -nodes
* openssl pkcs12 -in ciar.p12 -out ciar.crt.pem -clcerts -nokeys
*
**/
$CERT_CRT_PEM = 'certificado.crt.pem';

Keybase proof

I hereby claim:

  • I am jkfran on github.
  • I am jkfran (https://keybase.io/jkfran) on keybase.
  • I have a public key whose fingerprint is F1CC DD2C 0EED 5BBD 3E98 D5BD 5478 6D23 B613 D1FE

To claim this, I am signing this object: