Skip to content

Instantly share code, notes, and snippets.

View mintyPT's full-sized avatar
🦑

MG Santos mintyPT

🦑
View GitHub Profile
function doubleiter(nums: number[], target: number): number[] {
for(let i = 0; i<nums.length; i++){
for(let j = i+1; j<nums.length; j++){
}
}
};
const fs = require("fs")
const puppeteer = require("puppeteer")
// First level config
const project = "atelier/05"
const count = 50
// Second level config
const folder = `screenshots/${project}/`
@mintyPT
mintyPT / progress_list.py
Last active August 20, 2024 09:53
Class to help you keep track of the progress of a loop
import time
from datetime import timedelta
class ProgressList:
def __init__(self, data, step=1, description=None, eta=True):
self.data = data
self.total = len(data)
self.current_index = 0
self.step = step # Step interval for printing progress
self.start_time = None
@mintyPT
mintyPT / migration.py
Last active December 16, 2024 14:35
Migrate charfield's choice in django
# If you change some field's choice, django will not migrate the value at
# the database level. You need to do it.
#
# Generate an empty migration:
# > python manage.py makemigrations --empty <app_name>
#
# This will migration the value in the `state` field from `new` to `new_b`
# (and back if necessary).
from django.db import migrations