Skip to content

Instantly share code, notes, and snippets.

View bandaangosta's full-sized avatar
🌎

José L. Ortiz bandaangosta

🌎
View GitHub Profile
@sekcompsci
sekcompsci / Comparison Espressif ESP MCUs.md
Created June 18, 2021 03:56 — forked from fabianoriccardi/Comparison Espressif ESP MCUs.md
Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

Comparison table for ESP8266/ESP32/ESP32-S2/ESP32-S3/ESP32-C3/ESP32-C6

A minimal table to compare the Espressif's MCU families.

ESP8266 ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP32-C6
Announcement Date 2014, August 2016, September 2019, September 2020, December
@nickovs
nickovs / stepper.py
Last active November 14, 2023 22:07
A stepper motor driver for MicroPython
# stepper.py
# A micropython driver for 4-phase, unipolar stepper motors such as
# the 28BYJ-48
# Relesed to the Public Domain by Nicko van Someren, 2020
# The constructor for the Stepper class takes as arguments the four
# pins for driving the motor phases, in phase order, and optionally a
# timer. The pins can be passed as pin numbers or machine.Pin objects
@pszaflarski
pszaflarski / _remap_dict.py
Created July 9, 2018 17:49
remap a python dictionary with new keys
def _remap_dict(d, fromto_mapping, method='delete'):
"""
Remap dictionary keys from a certain set of keys to a new set of keys
:param d: the dictionary that needs to be remapped
:param fromto_mapping: a dictionary mapping of keys in the original dictionary to the output dictionary
:param method: what do do with keys that aren't found in the mapping
'delete' means that they will be removed from the output dictionary
'remain' means that they will have their original names in the output dictionary
:return: the output dictionary with keys remapped, will return None if method is not recognized
"""

Given a subscribed calendar with a url like

https://example.com/example.ics

To force Google Calendar to refresh and reload the contents right now, unsubscribe from the calendar and subscribe to a new calendar with a URL like

https://example.com/example.ics#1

Adding the anchor tag will force Google Calendar to think of it as a new calendar

@EvieePy
EvieePy / error_handler.py
Last active January 16, 2024 15:12
Simple Error Handling for ext.commands - discord.py
"""
If you are not using this inside a cog, add the event decorator e.g:
@bot.event
async def on_command_error(ctx, error)
For examples of cogs see:
https://gist.github.com/EvieePy/d78c061a4798ae81be9825468fe146be
For a list of exceptions:
https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#exceptions
@LeCoupa
LeCoupa / redis_cheatsheet.bash
Last active March 18, 2024 09:08
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@subfuzion
subfuzion / curl.md
Last active April 23, 2024 14:44
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@rvl
rvl / git-pushing-multiple.rst
Created February 9, 2016 11:41
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@rochacbruno
rochacbruno / mainpython.md
Last active July 5, 2023 10:56
Use of __main__.py

The use of __main__.py to create executables

myprojectfolder/
    |_ __main__.py
    |_ __init__.py

Being __main__.py:

print("Hello")

@subfuzion
subfuzion / http-status-codes.md
Last active September 3, 2023 09:15
General REST API HTTP Status Codes

Reference: RFC 2616 - HTTP Status Code Definitions

General

  • 400 BAD REQUEST: The request was invalid or cannot be otherwise served. An accompanying error message will explain further. For security reasons, requests without authentication are considered invalid and will yield this response.
  • 401 UNAUTHORIZED: The authentication credentials are missing, or if supplied are not valid or not sufficient to access the resource.
  • 403 FORBIDDEN: The request has been refused. See the accompanying message for the specific reason (most likely for exceeding rate limit).
  • 404 NOT FOUND: The URI requested is invalid or the resource requested does not exists.
  • 406 NOT ACCEPTABLE: The request specified an invalid format.