Skip to content

Instantly share code, notes, and snippets.

View hasanisaeed's full-sized avatar
💥
I wake up early and work hard :)

Saeed hasanisaeed

💥
I wake up early and work hard :)
View GitHub Profile
@hasanisaeed
hasanisaeed / create_databases.sh
Last active July 4, 2024 19:05
Sharding Implementation
#!/bin/bash
docker pull postgres:latest
docker run -d \
--name shard1 \
-e POSTGRES_PASSWORD=postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_DB=postgres \
-p 5435:5432 \
@hasanisaeed
hasanisaeed / fcm_push_notifications.py
Last active April 17, 2024 17:35
Python script to send push notifications using Firebase Cloud Messaging (FCM) and Google OAuth2.
import requests
from google.oauth2 import service_account
import google.auth.transport.requests
import google
SCOPES = ['https://www.googleapis.com/auth/firebase.messaging']
def get_access_token():
"""Retrieve a valid access token that can be used to authorize requests."""
credentials = service_account.Credentials.from_service_account_file(
@hasanisaeed
hasanisaeed / sources.list
Created September 26, 2023 12:55 — forked from hakerdefo/sources.list
Ubuntu 22.04 LTS (Jammy Jellyfish) complete sources.list
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
POSTGRES_DB=
pg_dump $POSTGRES_DB -U postgres | gzip > $POSTGRES_DB-$(date +%d-%m-%y_%H-%M).tar.gz
gunzip -c filename.gz | psql -U u -d db
@hasanisaeed
hasanisaeed / start.sh
Last active April 8, 2023 07:04
Re-create my OS
sudo apt update
echo ">> Installing vim editor..."
sudo apt install vim -y
echo ">> Installing python3.11..."
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update 
sudo apt install python3.11 -y
sudo apt install python3.11-venv -y
@hasanisaeed
hasanisaeed / print_c.py
Created December 29, 2022 12:13
Color printing in the terminal!
NO_COLOR = "0" # Text Reset
BLACK = "0;30" # Black
RED = "0;31" # Red
GREEN = "0;32" # Green
YELLOW = "0;33" # Yellow
BLUE = "0;34" # Blue
PURPLE = "0;35" # Purple
CYAN = "0;36" # Cyan
WHITE = "0;37" # White
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>GPS Ryca Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://unpkg.com/leaflet@1.0.3/dist/leaflet.css'>
<link rel='stylesheet'
href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css'>
@hasanisaeed
hasanisaeed / git.sh
Created February 5, 2022 11:34
Custom Git Commit
#!/bin/bash
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
WHITE='\033[0;m'
echo "$RED***** Design by ™Saeed ツ -V0.0.1 *****$WHITE"
helpFunction() {
echo "***** USAGE *****"
echo "$0 -a add -m '<your message>'"
@hasanisaeed
hasanisaeed / mixins.py
Created January 25, 2022 04:25 — forked from ceolson01/mixins.py
Django Group Required Mixin
from django.core.exceptions import PermissionDenied
class GroupRequiredMixin(object):
"""
group_required - list of strings, required param
"""
group_required = None
@hasanisaeed
hasanisaeed / git.sh
Created October 14, 2021 12:13
Git in one line.
#!/bin/bash
# Colors
GREEN='\033[0;32m'
RED='\033[0;31m'
WHITE='\033[0;m'
helpFunction() {
echo "***** USAGE *****"
echo "$0 -a add -m '<your message>'"