Skip to content

Instantly share code, notes, and snippets.

View Rustam-Z's full-sized avatar
🚀
Hello from Mars!

Rustam Zokirov Rustam-Z

🚀
Hello from Mars!
View GitHub Profile
import os
import sys
print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
@Rustam-Z
Rustam-Z / aws-index.html
Created February 21, 2022 06:24
Simple HTML file to run in the AWS EC2 instance to check the server
<html>
<body bgcolor=black>
<center>
<h2><font color=yellow>Hello from Mars!</font></h2>
<font color=red>Rustam-Z</font>
</center>
</body>
</html>
@Rustam-Z
Rustam-Z / import.py
Created February 25, 2022 16:56
Import Python modules using strings
import importlib
# Contrived example of generating a module named as a string
full_module_name = "tables." + "tasks"
# The file gets executed upon import, as expected.
mymodule = importlib.import_module(full_module_name)
# Then you can use the module like normal
var = mymodule.COLUMNS
import pathlib
print(pathlib.Path(__file__).parent.absolute())
@Rustam-Z
Rustam-Z / .gitignore
Created May 15, 2022 07:12
Gitignore template
venv/*
.*
*.pyc
__pycache__*/
@Rustam-Z
Rustam-Z / MyLogger.py
Created August 1, 2022 13:07 — forked from huklee/MyLogger.py
python Logger using example with Singleton Pattern
# -*- coding: utf-8 -*-
import logging
import os
import datetime
import time
class SingletonType(type):
_instances = {}