Skip to content

Instantly share code, notes, and snippets.

View dmiro's full-sized avatar

David Miró dmiro

View GitHub Profile
@namieluss
namieluss / python-pillow-image-add-border.py
Created March 16, 2020 05:36
Add Borders to Images using Python Pillow
from PIL import Image, ImageOps
# open image
img = Image.open("test_image.jpg")
# border color
color = "green"
# top, right, bottom, left
border = (20, 10, 20, 10)
@magickatt
magickatt / github_clone_using_token.sh
Created September 6, 2019 17:31
Clone a GitHub repository using a Personal Access Token
export GITHUB_USER=magickatt
export GITHUB_TOKEN=secret
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
@sidlors
sidlors / msys2_Windows.md
Last active January 11, 2024 14:58
msys2 windows

Integracion en WINDOWS: Cmder, Msys2, zhs, ohmyzhs, Eclipse, Visual code

Aunque no es obligatorio, sugiero utilizar cmnder como integrador de todas estas tecnologias, basicamente es un wrapper con mejors de ConEmu y Clink.

Cmder, Emulador de terminales Windows

Cmder es un paquete de software creado por pura frustración por la ausencia de buenos emuladores de consola en Windows. Se basa en un software increíble y está condimentado con el esquema de color Monokai y un diseño de aviso personalizado, luciendo sexy desde el principio.

@KornWtp
KornWtp / esp32+128x64 lcd+gps.io
Last active August 9, 2023 10:52
esp32+128x64 lcd+gps.io
#include <Arduino.h>
#include <U8g2lib.h>
#include <TinyGPS++.h>
#include <HardwareSerial.h>
#define TXPin (16)
#define RXPin (17)
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
@robertoandres24
robertoandres24 / asincronia.js
Last active September 27, 2023 20:31
Descripcion con ejemplos de Promises y en conjunto con Async/Await
//promise in a variable
let promise = new Promise(function(resolve, reject) {
setTimeout(() => resolve("done!"), 1000);
});
// resolve runs the first function in .then
promise.then(
result => console.log(result), // shows "done!" after 1 second
);
promise.catch(
CSS Pseudo Classes
Pseudo-classes select elements that already exist.
Based on current state of UI
:hover - an element is hovered
:enabled - an element is eanabled
:disabled - an element is disabled
:checked - an element is checked
@remarkablemark
remarkablemark / Dockerfile
Last active June 18, 2024 04:42
Install node and npm with nvm using Docker.
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active July 5, 2024 06:54
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@debuggerboy
debuggerboy / static_dir_to_root_flask.txt
Created September 6, 2015 09:13
Serving Static Files From Root “/” and not “/static” Using Flask
There’s some discussion about how to do this here, involving Werkzeug’s middleware.
http://stackoverflow.com/questions/4239825/static-files-in-flask-robot-txt-sitemap-xml-mod-wsgi
This is another way to do it, assuming you have a folder called “static” under where the main application .py file is located:
from flask import Flask, request
app = Flask(__name__, static_url_path='')
@app.route('/')
def root():
@vitan
vitan / load_csv_dict
Created January 20, 2015 08:01
How to load .csv as dict in Python, skipping initial space and quotechar
#!/usr/bin/env python
"""
Given file example.csv, with the following contents:
key1: 'I am value1'
key2: 'I am value2'
"""
import csv