Skip to content

Instantly share code, notes, and snippets.

@sergiobuj
sergiobuj / find_input_requirements_bpmn.py
Last active August 19, 2024 18:52
Cli parse kv params / encode/decode file
#!/usr/bin/env python3
import argparse
import re
from collections import defaultdict
from dataclasses import dataclass, field
from pathlib import Path
from xml.etree import ElementTree
@sergiobuj
sergiobuj / docker-compose.yml
Last active July 6, 2024 09:19
Prom PG test setup
services:
prom:
image: prom/prometheus
ports:
- 9090:9090
volumes:
- ./prom.yml:/prom.yml
command:
- '--config.file=/prom.yml'
@sergiobuj
sergiobuj / access.log
Last active June 19, 2024 11:54
Sample access.log file with a fields swapped and timestamp in RFC 3339 format.
1157689312.049 5006 10.105.21.199 TCP_MISS/200 19763 CONNECT login.yahoo.com:443 badeyek DIRECT/209.73.177.115 -
1157689320.327 2864 10.105.21.199 TCP_MISS/200 10182 GET http://www.goonernews.com/ badeyek DIRECT/207.58.145.61 text/html
1157689320.343 1357 10.105.21.199 TCP_REFRESH_HIT/304 214 GET http://www.goonernews.com/styles.css badeyek DIRECT/207.58.145.61 -
1157689321.315 1 10.105.21.199 TCP_HIT/200 1464 GET http://www.goonernews.com/styles.css badeyek NONE/- text/css
1157689322.780 1464 10.105.21.199 TCP_HIT/200 5626 GET http://www.google-analytics.com/urchin.js badeyek NONE/- text/javascript
1157689323.718 3856 10.105.21.199 TCP_MISS/200 30169 GET http://www.goonernews.com/ badeyek DIRECT/207.58.145.61 text/html
1157689324.156 1372 10.105.21.199 TCP_MISS/200 399 GET http://www.google-analytics.com/__utm.gif? badeyek DIRECT/66.102.9.147 image/gif
1157689324.266 1457 10.105.21.199 TCP_REFRESH_HIT/304 215 GET http://www.goonernews.com/graphics/newslogo.gif badeyek DIRECT/207.58.145.61
@sergiobuj
sergiobuj / notebook.ipynb
Last active May 15, 2024 11:57
How to align numbers to words of a sentence in the next line?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiobuj
sergiobuj / Dockerfile_alpine
Last active February 17, 2024 10:13
troubleshoot docker ENV
FROM alpine:latest
ENV no_proxy internal.example.com,internal2.example.com
ENV NO_PROXY internal.example.com,internal2.example.com
RUN apk update && apk upgrade
@sergiobuj
sergiobuj / index.ts
Created October 18, 2022 02:18
Testing "assemblyscript-json" to parse a custom object
import { JSON } from "assemblyscript-json/assembly";
// Parse an object using the JSON object
const payload = `
'{
"hello": "world",
"value": 24,
"pack": {
"123": {
@sergiobuj
sergiobuj / Pueblos.ipynb
Last active February 6, 2022 04:00
Colombia - "I trained an A.I. to generate British placenames"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sergiobuj
sergiobuj / Castle.xml
Created January 8, 2017 20:39 — forked from bemasher/Castle.xml
Example of parsing xml in golang.
<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Series>
<id>83462</id>
<Actors>|Nathan Fillion|Stana Katic|Molly C. Quinn|Jon Huertas|Seamus Dever|Tamala Jones|Susan Sullivan|Ruben Santiago-Hudson|Monet Mazur|</Actors>
<Airs_DayOfWeek>Monday</Airs_DayOfWeek>
<Airs_Time>10:00 PM</Airs_Time>
<ContentRating>TV-PG</ContentRating>
<FirstAired>2009-03-09</FirstAired>
<Genre>|Drama|</Genre>

Keybase proof

I hereby claim:

  • I am sergiobuj on github.
  • I am sergiobuj (https://keybase.io/sergiobuj) on keybase.
  • I have a public key ASCrhxq62efhlu1luvbnooGcizSldCi70aHCfNlFkVpuRAo

To claim this, I am signing this object:

@sergiobuj
sergiobuj / bin-search.cl
Created August 31, 2016 17:44
Learning CLisp - Implement Binary Search
(defun binary-search (key collection) ;; Function with simple signature
(defun binary-search-recursion (data element lower upper) ;; Helper function with multiple parameters
(let* ((range (- upper lower))
(mid (+ lower (round (/ range 2))))
(value (nth mid data)))
(cond
((= value element) mid)
((< range 1) -1)
((< value element) (binary-search-recursion data element (+ mid 1) upper))
((> value element) (binary-search-recursion data element lower (- mid 1))))))