Skip to content

Instantly share code, notes, and snippets.

View kmkmjhyiiiu's full-sized avatar
🎯
Focusing

... kmkmjhyiiiu

🎯
Focusing
  • Galaxy X
View GitHub Profile
from argparse import ArgumentParser
import os
import sys
class ArgParser(object):
def __init__(self):
self.parser = ArgumentParser()
self.isPrinted = False
<?php
/**
* ------------------------------------------------------------------------------------------
* Pratice array_columns, array_map, array_filter
* ------------------------------------------------------------------------------------------
*
* Simple and stupid but in OOP way to clear my concepts about some useful array functions.
*/
@kmkmjhyiiiu
kmkmjhyiiiu / laravel-5-nginx.conf
Created May 11, 2018 20:56
laravel 5 nginx config block file
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /var/www/html/public;
server_name localhost;
index index.php index.html index.htm;
charset utf-8;
@kmkmjhyiiiu
kmkmjhyiiiu / setup-php7.2-nginx.sh
Last active November 8, 2018 09:45
Setup PHP 7.2 , nginx with laravel 5 required modules + composer
# update repo
sudo apt-get update
# install nginx and add to firewall and restart it
sudo apt-get -y install nginx
sudo ufw allow 'Nginx HTTP'
sudo systemctl restart nginx
sudo systemctl enable nginx
# mysql
sudo apt-get -y install mysql-server
# required python system properties for adding repo
@kmkmjhyiiiu
kmkmjhyiiiu / index.php
Last active February 14, 2024 14:40
PHP Challenge
<?php
/**
* Author class
*/
class Author {
protected $name;
protected $email;
@kmkmjhyiiiu
kmkmjhyiiiu / multiprocess.py
Last active January 2, 2019 13:10
Limit Number Of Process to run at same time. (Python Multiprocessing)
from multiprocessing import Process as Mp
from typing import Tuple
from time import sleep
class Process(Mp):
"""
Added Custom method for checking if process has started.
"""
@kmkmjhyiiiu
kmkmjhyiiiu / mega.py
Created December 25, 2018 18:48
bypass mega downloading limit with tor - Tested in ubuntu
from time import sleep
import subprocess
if __name__ == '__main__':
while True:
subprocess.call(["killall " + " megasync"], shell = True)
subprocess.call(["kill -9 " + " `pidof tor`"], shell = True)
subprocess.call(["tor &"], shell = True)
subprocess.call(["megasync &"], shell = True)
sleep(60 * 15)
@kmkmjhyiiiu
kmkmjhyiiiu / youtube_main.py
Created January 23, 2019 18:15
Download list of yt videos to mp3
from subprocess import Popen
def main():
_list = open('list.txt', 'r').read().splitlines()
for link in _list:
p = Popen(executable="/home/ammadkhalid/.local/bin/youtube-dl", args=[
'-i',
'--extract-audio',
'--audio-format',
@kmkmjhyiiiu
kmkmjhyiiiu / wp-config.php
Created May 2, 2019 01:49
if ever had a too many redirects issue on fresh installation of wordpress - append the following at end of file.
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
@kmkmjhyiiiu
kmkmjhyiiiu / gender_api.py
Created August 7, 2019 11:34
Gender Api module for python
from urllib.parse import urljoin
from requests import Session, Response
class InvalidGenderApiResponse(Exception):
"""
Exception class if in cause response is not ok from gender api.
"""