Skip to content

Instantly share code, notes, and snippets.

View iurisilvio's full-sized avatar

Iuri de Silvio iurisilvio

View GitHub Profile
@mihow
mihow / image_from_url.py
Created September 11, 2023 23:10
Load image into PIL object from URL with streaming request, one line
import requests
from PIL import Image
image = Image.open(requests.get(url, stream=True).raw)
@jbranchaud
jbranchaud / postgres-migrating-from-int-to-bigint.md
Created July 5, 2023 22:49
PostgreSQL: Migrating from INT to BIGINT
@jcrist
jcrist / bench.py
Last active January 27, 2025 21:01
A quick benchmark comparing msgspec (https://github.com/jcrist/msgspec), pydantic v1, and pydantic v2
"""A quick benchmark comparing the performance of:
- msgspec: https://github.com/jcrist/msgspec
- pydantic V1: https://docs.pydantic.dev/1.10/
- pydantic V2: https://docs.pydantic.dev/dev-v2/
The benchmark is modified from the one in the msgspec repo here:
https://github.com/jcrist/msgspec/blob/main/benchmarks/bench_validation.py
I make no claims that it's illustrative of all use cases. I wrote this up
@autoize
autoize / 6977.diff
Created December 31, 2019 15:06
Pull request #6977 for Amazon SES API support in Mautic 2.15.3
diff --git a/app/bundles/EmailBundle/Assets/js/config.js b/app/bundles/EmailBundle/Assets/js/config.js
index f233d59f3f..5951c08143 100644
--- a/app/bundles/EmailBundle/Assets/js/config.js
+++ b/app/bundles/EmailBundle/Assets/js/config.js
@@ -66,6 +66,7 @@ Mautic.testMonitoredEmailServerConnection = function(mailbox) {
Mautic.testEmailServerConnection = function() {
var data = {
amazon_region: mQuery('#config_emailconfig_mailer_amazon_region').val(),
+ amazon_api_region: mQuery('#config_emailconfig_mailer_amazon_api_region').val(),
api_key: mQuery('#config_emailconfig_mailer_api_key').val(),
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 12, 2025 19:28
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@vinicius73
vinicius73 / 0-contribua-.md
Last active October 17, 2024 19:32
Guia de referencias sobre estudo de JavaScript

Contribua

Se você quiser adicionar mais algum tópico deixe seu comentário, o objetico é facilitar para os iniciantes ou aqueles que buscam dominar JavaScript, quais tópicos são importantes para dominar JavaScript.

São tópicos para quem sabe o minimo de JavaScript (declarar variáveis), a ordem em que eles aparecem são por importância para o dominio como um todo. Mesmo que você já tenha experiência com JS, recomendo que leia os links de cada tópico para fortalecer suas bases teóricas e ter um comportamento mais profundo da linguagem.

Lista originalmente criada e compilada por Vinicius Reis

from __future__ import unicode_literals
import os
import re
import time
import unicodedata
from collections import OrderedDict
from datetime import date
from optparse import OptionParser
from xml.dom.pulldom import START_ELEMENT, parse
# Builder file for sentry
#
FROM ubuntu
MAINTAINER Michael Crosby
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade
@nebirhos
nebirhos / jquery.ajax.progress.js
Created October 15, 2012 11:26 — forked from db/jquery.ajax.progress.js
add XHR2 upload and download progress events to jQuery.ajax
(function addXhrProgressEvent($) {
var originalXhr = $.ajaxSettings.xhr;
$.ajaxSetup({
xhr: function() {
var req = originalXhr(), that = this;
if (req) {
if (typeof req.addEventListener == "function" && that.progress !== undefined) {
req.addEventListener("progress", function(evt) {
that.progress(evt);
}, false);
@jboner
jboner / latency.txt
Last active May 13, 2025 03:08
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD