Skip to content

Instantly share code, notes, and snippets.

View hasanisaeed's full-sized avatar

Saeed hasanisaeed

View GitHub Profile
مشکلی به نام تحریم یافیلترینگ pypi.org
چند روزی است که متأسفانه دسترسی به وبسایت pypi.org و نصب بسته های پایتونی توسط pip با مشکل مواجه شده است. از این رو لازم هست از روش‌های جایگزین موجود استفاده کرد از جمله :
۱. استفاده از vpn ها 😩
۲. تحریم شکن ها ( مدعی تحریمی بودن سایت بالا که البته من ۵ تحریم شکن مختلف رو چک کردم و هیچ کدوم روی همراه اول و صبا نت جواب نداده اند!)🤥
۳. استفاد ه از آیینه ها ( mirrors ). 🤓
برا استفاده از آیینه ها میتوانید به صورت زیر عمل کنید:
pip install --trusted-host [host] -i [address] some-pckage
@hasanisaeed
hasanisaeed / server.c
Created October 22, 2024 08:19
simple web server
#include <stdlib.h>
#include <stdio.h>
#include <WinSock2.h>
// 1:
void init_sock()
{
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData);
}
@hasanisaeed
hasanisaeed / live.dart
Created October 1, 2024 07:28
Live Location
// ignore_for_file: empty_catches
import 'dart:async';
import 'dart:convert';
import 'package:firestation_manager_app/data/helpers/constants/network_constants.dart';
import 'package:latlong2/latlong.dart';
import 'package:web_socket_channel/web_socket_channel.dart';
import 'dart:developer';
import 'dart:io';
import 'dart:isolate';
@hasanisaeed
hasanisaeed / book.proto
Last active August 29, 2024 13:46
System design -> API Getways -> gRPC, GraphQL
syntax = "proto3";
service BookService {
rpc GetBooks (Empty) returns (BookList);
rpc GetBookByTitle (BookTitle) returns (Book);
rpc AddBook (Book) returns (Book);
rpc UpdateBook (UpdateBookRequest) returns (Book);
rpc DeleteBook (BookTitle) returns (DeleteBookResponse);
}
CC = gcc
CFLAGS = -Wall -fPIC
LIBNAME = my_lib
all: $(LIBNAME).so
$(LIBNAME).so: my_lib.o
$(CC) -shared -o $@ $^
my_lib.o: my_lib.c my_lib.h
@hasanisaeed
hasanisaeed / create_databases.sh
Last active August 9, 2024 09:26
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