Skip to content

Instantly share code, notes, and snippets.

print("je")
import re
import sqlite3
import string
from pathlib import Path
from pprint import pprint
import jwt
from faker import Faker
.contacts {
display: grid;
width: 90%;
grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
gap: 1.5rem;
margin: auto;
}
.contact {
@ahmedlahrizi
ahmedlahrizi / create_random_data.py
Created July 8, 2021 11:13
random data from faker for django model
#from django.db import models
#from django.contrib.auth.models import User
#class Category(models.Model):
# name = models.CharField(max_length=36)
#class BlogPost(models.Model):
# title = models.CharField(max_length=50)
if max_nb_chars < 25:
# join words
while not text:
size = 0
# determine how many words are needed to reach the $max_nb_chars
# once;
while size < max_nb_chars:
word = (self.word_connector if size else '') + \
self.word(ext_word_list=ext_word_list)
text.append(word)
@ahmedlahrizi
ahmedlahrizi / bigprojects.ino
Created August 31, 2021 16:49
Arduino big projects
// include the Servo library
#include <Servo.h>
Servo ServoPen; // create a servo object
unsigned short sensors_enabled = 0;
const unsigned short touch_sensor_pin = 10;
const unsigned short servo_pen_pin = 9;
const unsigned short ball_pin = 2;
@ahmedlahrizi
ahmedlahrizi / bigg_project.ino
Created September 7, 2021 21:27
Code for a project
#include <Arduino.h>
#include <TimeLib.h>
#include <LiquidCrystal.h>
#include <Wire.h>
#define CURRENT_TIMESTAMP 1631014463
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
byte smile[8] = { 0b00000, 0b00000, 0b01010, 0b00000, 0b10001, 0b01110, 0b00000, 0b00000 }; // :)
byte no_smile[8] = { 0b00000, 0b00000, 0b01010, 0b00000, 0b01110, 0b10001, 0b00000 ,0b00000 }; // :(
from sys import argv
import json
import dateparser
if len(argv) != 3:
print("Usage: python ns_cookies.py {Cookies in json format} {Output file}")
with open(argv[1], "r") as db:
s = json.load(db)