Skip to content

Instantly share code, notes, and snippets.

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

Sergio Soto ssoto

🏠
Working from home
View GitHub Profile
@ssoto
ssoto / qr_function.py
Last active May 17, 2023 15:00
Mentoriando vol. III
import qrcode
import qrtools
import uuid
def create_qr_code(qr_content, qr_path):
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(qr_content)
qr.make(fit=True)
imagen_qr = qr.make_image(fill_color="black", back_color="white")

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

sudo apt-get install software-properties-common && \
sudo add-apt-repository ppa:deadsnakes/ppa && \
sudo apt-get update && \
sudo apt-get install python3.6 python3.6-dev
@ssoto
ssoto / example.py
Last active June 6, 2018 15:28
Python typing function exampel
def foo_function(a: int, b: int) -> int:
return a + b
# First ussage example
result_a = foo_function(4, 10)
type(result_a)
>>> int
print(result_a)
>>> 14
import datetime
import json
PROJECT = 'sparta'
KIBANA_URL = 'http://elastic:9200/{}-'.format(PROJECT)
def send_to_kibana():
headers = {'Content-Type': 'application/json',
'Accept': 'text/plain'}
today = data['out'].strftime('%Y.%m.%d')
@ssoto
ssoto / Ussage.py
Last active October 11, 2017 14:45
Benchmark decorator
from usefull_decorators import command_decorator
logger = logging.getLogger('Command')
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
# decorator needs a logger object
@command_decorator(logger)
def f_example(a):
print("managing proces... with args: %s" %(a))
@ssoto
ssoto / benchmark.py
Created March 21, 2017 15:59
Python time profiling
#!python
# -*- coding: utf-8 -*-
import importlib
import os
from timeit import default_timer as timer
import logging
from my_module import config
class benchmark(object):
@ssoto
ssoto / falcon_wrapper.py
Created July 21, 2016 14:38
Falcon dynamic service creation
# -* coding: utf-8 *-
import json
import traceback
import falcon
class Resource(object):
def __init__(self):
@ssoto
ssoto / random_syslog.sh
Created June 24, 2015 14:01
Random syslog message sent each random seconds
#!/bin/bash
POS=2
LEN=16
SECONDS_MAX=10
while true; do
str1=$( echo -n `date +\"%s\"` | md5sum | md5sum )
@ssoto
ssoto / notes.md
Created April 14, 2015 16:15
Seminarios de Seguridad Informática (Quivir Research Group)