Skip to content

Instantly share code, notes, and snippets.

View aalmiramolla's full-sized avatar
👨‍💻
Working hard!

Alejandro aalmiramolla

👨‍💻
Working hard!
View GitHub Profile
@EnriqueSoria
EnriqueSoria / validate_dataclass.py
Last active March 5, 2024 21:51 — forked from rochacbruno/validate_dataclass.py
Validate Dataclass Python
import logging
from dataclasses import dataclass
from typing import Union, List
logger = logging.getLogger(__name__)
class Validations:
@aalmiramolla
aalmiramolla / traceroute.py
Last active June 26, 2024 09:09 — forked from inaz2/traceroute.py
Python implementation of traceroute
# references:
# Learning by doing: Writing your own traceroute in 8 easy steps (Ksplice Blog)
# https://blogs.oracle.com/ksplice/entry/learning_by_doing_writing_your
# Edited by: Alejandro Almira <laboral at alejandroalmira.com>
import datetime
import socket
import sys
@naltun
naltun / la-tricolor.sh
Last active November 10, 2022 09:53
La bandera de la Segunda República Española
#!/bin/bash
echo -ne "\e[34m"
echo -e "\e[41m \e[40m"
echo -e "\e[43m \e[40m"
echo -e "\e[45m \e[40m"
echo -ne "\e[0m"
@amanusk
amanusk / display.sh
Last active August 7, 2023 01:46
Easily change between laptop and external displays in i3 + dmenu
#!/bin/bash
# This script is intended to make switching between laptop and external displays easier when using i3+dmenu
# To run this script, map it to some shortcut in your i3 config, e.g:
# bindsym $mod+p exec --no-startup-id $config/display.sh
@kphretiq
kphretiq / Flask-SqlAlchemy-Many-to-Many.py
Last active March 16, 2024 17:18
A (hopefully) simple demo of how to do many-to-many relationships using Flask-SQLAlchemy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from flask import Flask, url_for
from flask_sqlalchemy import SQLAlchemy
"""
Flask-SQLAlchemy many-to-many relationship using helper table
http://flask-sqlalchemy.pocoo.org/2.1/models/
Hippies love their dogs.
@mhitza
mhitza / Makefile
Last active June 4, 2024 00:37
Programming Arduino Uno (ATmega386P) in assembly
%.hex: %.asm
avra -fI $<
rm *.eep.hex *.obj *.cof
all: $(patsubst %.asm,%.hex,$(wildcard *.asm))
upload: ${program}.hex
avrdude -c arduino -p m328p -P /dev/arduino-uno -b 115200 -U flash:w:$<
monitor:
@ericandrewlewis
ericandrewlewis / index.md
Last active June 6, 2024 01:43
C++ Pointer Tutorial

C++ Pointer Tutorial

Because pointers can be ugh

"Regular" variables (not pointers)

To understand a pointer, let's review "regular" variables first. If you're familiar with a programming language without pointers like JavaScript, this is what you think when you hear "variable".

When declaring a variable by identifier (or name), the variable is synonymous with its value.

@p53ud0k0d3
p53ud0k0d3 / python-mailer.py
Last active August 24, 2023 01:58
Simple python program for sending emails from Gmail and Hotmail.
"""python-mailer.py
Author : Vishnu Ashok
Contact : thisisvishnuashok@gmail.com
thisisvishnuashok@hotmail.com
GitHub : http://github.com/p53ud0k0d3
This is a simple email client program, which can be used to send emails from Gmail and Hotmail.
You must enable "Allow less secure apps" in Gmail settings.
"""
@pingwping
pingwping / gist:92219a8a1e9d44e1dd8a
Last active March 6, 2023 18:35
Create and update embedded documents with MongoEngine
# REF: http://www.quora.com/How-do-I-create-and-update-embedded-documents-with-MongoEngine
class Comment(EmbeddedDocument):
content = StringField()
name = StringField(max_length=120)
class Post(Document):
title = StringField(max_length=120, required=True)
author = StringField(required=True)
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote