This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from argparse import ArgumentParser | |
import os | |
import sys | |
class ArgParser(object): | |
def __init__(self): | |
self.parser = ArgumentParser() | |
self.isPrinted = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ------------------------------------------------------------------------------------------ | |
* Pratice array_columns, array_map, array_filter | |
* ------------------------------------------------------------------------------------------ | |
* | |
* Simple and stupid but in OOP way to clear my concepts about some useful array functions. | |
*/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Author class | |
*/ | |
class Author { | |
protected $name; | |
protected $email; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) | |
$_SERVER['HTTPS']='on'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
""" |
OlderNewer