Skip to content

Instantly share code, notes, and snippets.

View MagedSaeed's full-sized avatar
🎯
Focusing

Maged Saeed MagedSaeed

🎯
Focusing
View GitHub Profile
@ma7dev
ma7dev / test_sorting.py
Created April 25, 2022 10:30
Testing sorted()
import random
def naive_way_of_sorting(arr):
for i in range(len(arr)):
for j in range(i+1, len(arr)):
if arr[i] > arr[j]:
arr[i], arr[j] = arr[j], arr[i]
return arr
def test_sorting(size):
t = "blah blah"
t = araby.strip_tashkeel(t) #remove tashkeel
t = re.sub(r'([-؟،.!;:])', ' \\1 ', t) #add spaces between special charaacters
t = re.sub(r'([^\s\w\-؟،.!;:])+', '', t) #remove all special characters except some
t = re.sub(r'[³ـ¼]', '', t) #explecitly remove some special characters
t = re.sub('[a-zA-z]', '', t) #remove english litters
@andreacarriero
andreacarriero / setup_firewall.yml
Created February 28, 2018 19:25
[Ansible Playbook] Setup UFW to allow only incoming ssh connections
---
- hosts: all
become: true
tasks:
- name: ensure ufw installed
apt: name=ufw update_cache=true
- name: ufw deny incoming
ufw:
direction: incoming
@jamesbrobb
jamesbrobb / multiform.py
Last active July 4, 2023 18:53 — forked from michelts/gist:1029336
django multiform mixin and view that allows the submission of a) All forms b) Grouped forms c) An individual form
class MultiFormMixin(ContextMixin):
form_classes = {}
prefixes = {}
success_urls = {}
grouped_forms = {}
initial = {}
prefix = None
success_url = None
@sente
sente / formatXML.js
Last active April 4, 2024 12:20
javascript to format/pretty-print XML
The MIT License (MIT)
Copyright (c) 2016 Stuart Powers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: