Skip to content

Instantly share code, notes, and snippets.

@Stovoy
Stovoy / convert_webp_to_gif.py
Created April 17, 2023 21:17
A script to convert an animated webp image to gif
from PIL import Image
def convert_webp_to_gif(webp_file, gif_file):
# Open the WEBP file using the PIL library
webp_image = Image.open(webp_file)
# Initialize lists to store the frames and durations of the WEBP image
frames = []
durations = []
import asyncio
import aiohttp
from bs4 import BeautifulSoup
base_url = "https://control.fandom.com"
all_collectibles = "/wiki/Collectibles/List_of_Collectibles"
def stats(text):
# Minimum moves solver for https://www.funnyhowtheknightmoves.com/
from collections import deque
import chess
def main():
destinations = [chess.F8, chess.E8, chess.C8, chess.B8,
chess.H7, chess.G7, chess.E7, chess.C7, chess.A7,
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using CommunityToolkit.HighPerformance;
public struct Position {
public float x;
public float y;
};
public class TestStructModification {
@Stovoy
Stovoy / rotate_pennies.py
Last active December 14, 2022 15:56
A script to correct the rotation of pennies using OpenCV
import argparse
import math
import multiprocessing
import os
import itertools as it
from scipy import ndimage
from skimage.metrics import structural_similarity
import cv2
import numpy as np
import math
import time
import pygame
class Vector:
def __init__(self, p1, p2):
self.x1, self.y1 = p1
self.x2, self.y2 = p2
package main
import (
"fmt"
"sort"
"strings"
)
type Shape struct {
grid [][]bool
use rdev::{simulate, grab, Event, EventType, Key};
static mut SIMULATED: u32 = 0;
fn main() {
if let Err(error) = grab(callback) {
println!("Error: {:?}", error)
}
}
I’ve just finished reading through the now approved proposal for generics in Go and am beyond excited.
Speaking as someone who works for a major tech company that uses primarily Go, and having personally been writing Go on-and-off for over 5 years, I believe this will be a huge game changer.
In particular, this will very strongly support and encourage companies to use Go for higher performance critical projects as opposed to C++ or Rust. Allow me to illustrate why I believe this to be the case.
I’m a big fan of Rust as well, and had attempted to introduce it at work in the past. It’s difficult to integrate, and the learning curve is a problem, as well as general complexity in comparison to the extreme ergonomics of Go.
Why Rust? Rust has no garbage collector, and is certainly faster than Go, due to having effectively no runtime. For real time computing, projects with extreme performance requirements, or with strict memory budgets, Rust will still be superior.
However, there’s a middle ground where Go will now
import string
import requests
letters = 'lairodm'
must_have = 'm'
length = 4
raw = requests.get(
'https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt').text.split('\n')