Skip to content

Instantly share code, notes, and snippets.

@devwaseem
devwaseem / MaxFileSizeValidatorInMb.py
Created November 9, 2022 11:38
Max File size validator for Django
from django.core.exceptions import ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _
@deconstructible
class MaxFileSizeValidatorInMb:
message = _("The file size is %(current_file_size)s MB, exceeding the maximum file size of %(max_file_size)s MB ")
code = "file_size_exceeded"
@devwaseem
devwaseem / my-mac-setup.sh
Created February 21, 2021 06:28 — forked from nickytonline/my-mac-setup.sh
Mac Setup Scripts
#!/bin/sh
# More Mac setup at https://mac.iamdeveloper.com
# Log file
timestamp=$(date +%s)
logFile="./my-mac-setup-$timestamp.log"
# if true is passed in, things will reinstall
reinstall=$1
import string
punctuations = list(string.punctuation)
punctuations.remove("-") # we are treating hyphen as seperator so remove it from punctuation list
punctuations = "".join(punctuations)
def piglatin(ogtext):
@devwaseem
devwaseem / number_to_pattern
Created July 31, 2016 05:20
Number to pattern
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner scan=new Scanner(System.in);
System.out.println("Enter a number: ");
spacer s=new spacer();
int n=scan.nextInt(),temp=n,temp2=n-1,temp3=1,pass=0,space=0;
String style="*";