Skip to content

Instantly share code, notes, and snippets.

View mhsharifi96's full-sized avatar
:bowtie:
Never give Up

MohammadHossein sharifi mhsharifi96

:bowtie:
Never give Up
  • Crown Financial Services Limited
  • Tehran
  • 04:04 (UTC -12:00)
View GitHub Profile
@mhsharifi96
mhsharifi96 / sample_postgres_query.md
Last active August 19, 2022 09:31
sample postgres query (from simple to advance)

Quereis (0-100)

لیست پرداخت

select count(*) from payment

مقدار فروش هر کارمند

select staff_id,sum(amount) as total_amount from payment 

DATABASE

what is schema?

Schema is a collection of logical structures of data. In PostgreSQL, schema is a named collection of tables, views, functions, constraints, indexes,sequences etc.


Create Database

@mhsharifi96
mhsharifi96 / sample_asyncio.py
Last active March 8, 2022 11:47
simple example with asyncio, that show how async function works
import asyncio
import time
async def sample():
start_time = time.time()
print('start')
await asyncio.sleep(1)
await asyncio.sleep(2)
print('after 2s sleep on sample ')
await asyncio.sleep(1)
@mhsharifi96
mhsharifi96 / palindrome.py
Last active January 31, 2022 18:20
Palindrome Linked List in Python with O(1) Extra Space (O(n) time)
class ListNode:
def __init__(self, val=0, next = None):
self.next = next
self.val = val
class Solution:
def isPalindrome(self, head:ListNode) -> bool:
fast = head
slow = head
#find middle
@mhsharifi96
mhsharifi96 / Additive_Model.lg4
Created August 23, 2020 17:30
!Additive Model Lingo Code
!Additive Model Lingo Code
write by Mohammad hossein sharifi
Aug 2020;
model:
sets:
dmu/1..10/:l;
input/1..4/:si;
output/1..3/:sr;
link1(input,dmu):x;
link2(output,dmu):y;
@mhsharifi96
mhsharifi96 / bcc_output.lg4
Created August 23, 2020 16:43
BCC model OutPut Oriented Lingo Code
! BCC model OutPut Oriented Lingo Code;
! write by mohammad hossein
sharifi Aug 2020;
model:
sets:
dmu/1..10/; !10 dmu;
input/1..4/:v; !4 input;
output/1..3/:u; !3 output ;
link(input,dmu):x; !xij 4*10;
@mhsharifi96
mhsharifi96 / bcc_input.lg4
Last active August 23, 2020 16:36
BCC model output Oriented lingo code
! BCC model input Oriented lingo code ;
!write by mohammad hossein sharifi Aug 2020;
model:
sets:
dmu/1..10/; !10 dmu;
input/1..4/:v; !4 input;
output/1..3/:u; !3 output ;
link(input,dmu):x; !xij 10*4;
model :
sets:
Cinput/1..2/:i;
Coutput/1/:r;
dmu/1..10/:j;
Winput/1..2/:v;
Woutput/1/:u;
link(Cinput,dmu):x;
link1(Coutput,dmu):y;
endsets
@mhsharifi96
mhsharifi96 / changeMetaDataMP3.js
Last active April 2, 2020 11:32
change metadata mp3 by node js
//https://www.npmjs.com/package/ffmetadata#metadata
//sometimes you need change metadata in mp3 automatically
var ffmetadata = require("ffmetadata");
function ChangeMetaMp3(filename){
data = {
album: "RovzeNews.ir",
copyright: "RovzeNews.ir - tel/insta : @rovzenews_ir"
}
#!/usr/bin/python3.5
class tape:
def __init__(self,Sum,p):
self.sum_a=Sum
self.p=p
def SUM(self):
Min=Sum
for i in range(p):
sum_left=sum(a[:i])
sum_right=Sum-sum_left