Skip to content

Instantly share code, notes, and snippets.

View hassanuos's full-sized avatar
😇
I may be slow to respond.

Hassan Raza hassanuos

😇
I may be slow to respond.
View GitHub Profile
def my_arg_function(*args):
for arg in args:
print(arg)
my_arg_function("Hassan", "Raza", "Dev")
#output
# Hassan
# Raza
import imaplib
import pprint
import os
import base64
import email
import pandas as pd
import time
#List of suppliers that have their own folder
supplierlist = ["OSG", "SGS", "SECO", "YMW", "SGS2"]
@hassanuos
hassanuos / with_clause_mysql.sql
Created October 2, 2023 09:20
Use with clause on MySql example
WITH RECURSIVE my_cte AS
(
SELECT provider_id, count(*) as correct_answers from obs_provider_answers
where is_correct = 1
group by provider_id
having correct_answers = 4
)
select * from obs_provider where provider_id in(SELECT my_cte.provider_id FROM my_cte) and status = 3
@hassanuos
hassanuos / event-tide-windows-server.py
Created July 15, 2023 11:11
File migrations with all it's revision from a datasource to windows server and created a mapping file to track each and every file without any interruptions.
import pickle
import sys
import re
import requests
import json
from datetime import datetime, timedelta
from dateutil import parser
import os
import os.path
import socket
@hassanuos
hassanuos / upload-file-to-remote-server.php
Created May 24, 2023 14:47
Laravel script to upload file to remote server.
<?php
namespace App;
use DB;
use Storage;
use phpseclib\Net\SFTP;
use phpseclib\Crypt\RSA;
class UploadFile {
@hassanuos
hassanuos / SavedCronJobsDatabase.php
Created May 23, 2023 14:18
Database saved cron jobs in database execution in laravel.
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Carbon\Carbon;
use Illuminate\Support\Facades\Mail;
use DB;
// Cron Expression
use Cron\CronExpression;
@hassanuos
hassanuos / EventConfigurant.php
Created December 14, 2022 09:49
debug Yii2 for all requests
<?php
public function bootstrap($app)
{
Yii::$app->on('afterRequest', function($event) {
$event->sender->request->headers ;
try{
Yii::$app->db->createCommand()->insert('untitled_table', [
@hassanuos
hassanuos / find_exact_words_from_sentence.php
Created September 14, 2022 08:14
Find 100% matching words and remove them from the sentence and return the exact sentence after removing.
<?php
$allContent = "Fantastic hotel in the central of Dublin. Rooms are a bit on the small side, but very modern and well planned. You have a small fully equipped kitchen area, which is good stay for more than a few days. There is also a small barcoffee shop in the lobby with reasonable prices. Very friendly and service minded staff. You have walking distance to Christ Church Cathedral, the Castle, and all pubs and restaurants in the Temple Bar District.";
$getChars = array_filter(explode(" ", $allContent));
$getChars = array_map(function ($item){
return strtolower($item);
}, $getChars);
$profaneWords = [
"i",
@hassanuos
hassanuos / ngram-stop-words.php
Created September 12, 2022 10:33
With this class you can make block a group of words from your reviews, comments or any other kind of data. This class function 'findNGramBetweenSameDataSet' also return the most number of repeated words or sentences in the same group of data set.
<?php
/**
* Class Ngrams
*/
class Ngrams
{
public function init()
{
//
@hassanuos
hassanuos / shoppingCart.js
Created September 7, 2022 08:29 — forked from alexhawkins/shoppingCart.js
Example of a Module Design Pattern in JavaScript
/*MODULE PATTERN*/
//create a namespace
var shoppingCart = (function() {
//private variables
var total;
var basket = [];
//private methods