This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moderngl | |
import numpy as np | |
import glfw | |
# Inicializar GLFW | |
if not glfw.init(): | |
raise Exception("No se pudo inicializar GLFW") | |
# Establecer la versión de OpenGL que queremos usar (por ejemplo, OpenGL 3.3) | |
glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# falco_rules.yaml | |
- list: authorized_devices | |
items: [device_1, device_2, device_3] | |
- list: malicious_urls | |
items: [malicious.com, phishing.com, malware.com] | |
- rule: High Frequency QR Scans | |
desc: Detect multiple scans of the same QR code in a short time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import BartForConditionalGeneration, BartTokenizer | |
import requests | |
from bs4 import BeautifulSoup | |
## Function to summarize article | |
def summarize_article(article_text, max_length=150): | |
model_name = "facebook/bart-large-cnn" | |
tokenizer = BartTokenizer.from_pretrained(model_name) | |
model = BartForConditionalGeneration.from_pretrained(model_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
# NATO phonetic alphabet encoder dictionary | |
nato_encoder = { | |
'A': 'Beta', 'B': 'Gamma', 'C': 'Cypher', 'D': 'Epsilon', | |
'E': 'Zeta', 'F': 'Eta', 'G': 'Theta', 'H': 'Iota', | |
'I': 'Kappa', 'J': 'Lambda', 'K': 'Mu', 'L': 'Nu', | |
'M': 'Xi', 'N': 'Omicron', 'O': 'Pi', 'P': 'Rho', | |
'Q': 'Sigma', 'R': 'Tau', 'S': 'Upsilon', 'T': 'Phi', | |
'U': 'Chi', 'V': 'Psi', 'W': 'Omega', 'X': 'Alpha', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from faker import Faker | |
import random | |
fake = Faker() | |
def generate_fake_data(num_entries=10): | |
data = [] | |
for _ in range(num_entries): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Query original: | |
SELECT | |
u.user_id,u.username,u.email, COALESCE(SUM(o.total_amount), 0) AS total_ spent, COUNT(DISTINCT o. order_id) AS total_orders, | |
ROUND (AVG(o. total_amount, 2) AS avg_order_value, | |
MAXo. total amount) AS max order_value, | |
RANK() OVER (ORDER BY SUM(o. total_amount) DESC) AS spending_rank, | |
SELECT MAX(02. order_date) | |
FROM orders 02 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Prompt the user for a link | |
echo "Please enter the link to scan:" | |
read link | |
# Output the entered link | |
echo "You entered: $link" | |
curl -s "https://crt.sh/?q=%25.$link&output=json" | jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from openai import OpenAI | |
import requests | |
from dotenv import load_dotenv | |
import time | |
import os | |
import json | |
load_dotenv() | |
client = OpenAI() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install openai | |
# para probarlo, me bajo el libro Moby Dick, lo divido en 72 secciones y envio cada seccion gpt-4. | |
# Hay que tener cuidado con los parametros MAX_TOKENS_PER_CHUNK y SUMMARY_TOKEN_LIMIT para no molestar a openAI. | |
from openai import OpenAI | |
import requests | |
from dotenv import load_dotenv | |
load_dotenv() | |
client = OpenAI() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ListaDobleEnlazada<T> { | |
private Nodo<T> cabeza; | |
private Nodo<T> cola; | |
// Clase interna Nodo | |
private static class Nodo<T> { | |
T dato; | |
Nodo<T> siguiente; | |
Nodo<T> anterior; |