Skip to content

Instantly share code, notes, and snippets.

View Rizwan-Hasan's full-sized avatar
🌏
Working remotely

Rizwan Hasan Rizwan-Hasan

🌏
Working remotely
View GitHub Profile
import cx_Oracle
def main():
# Variables
username: str = "HR"
password: str = "<YOUR_PASSWORD>"
host: str = "localhost"
service: str = "XE"
# Connection establishing
@Rizwan-Hasan
Rizwan-Hasan / pyside2_qrunnable_signal_test.py
Created February 21, 2020 10:33 — forked from dalejfer/pyside2_qrunnable_signal_test.py
Run a QTheadPool with signal emitting QRunnable workers. Capture the signals in the main thread and update the UI.
#!python3.7
import random
import time
import PySide2
from PySide2 import QtCore, QtWidgets
from PySide2.QtCore import Slot, Signal, QObject, QThreadPool, QRunnable
class MyEmitter(QObject):
@Rizwan-Hasan
Rizwan-Hasan / dark_fusion.py
Last active February 25, 2020 18:32 — forked from lschmierer/dark_fusion.py
Qt5 Dark Fusion Palette for Python
qApp.setStyle(QStyleFactory.create("Fusion"))
darkPalette = QPalette()
darkColor = QColor(45, 45, 45)
disabledColor = QColor(127, 127, 127)
darkPalette.setColor(QPalette.Window, darkColor)
darkPalette.setColor(QPalette.WindowText, Qt.white)
darkPalette.setColor(QPalette.Base, QColor(40, 40, 40))
darkPalette.setColor(QPalette.AlternateBase, darkColor)
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('localhost', 1080))
s.listen()
message = "Hello World"
message = bytes(message, "utf-8")
while True:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('localhost', 1080))
message = ''
while True:
msg = s.recv(1)
if len(msg) <= 0:
break
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1 align="center">Redirecting in <span id="countdown">10</span> seconds</h1>
<script type="text/javascript">
// Total seconds to wait
var seconds = 10;
# ~/.config/systemd/user/jupyter.service
[Unit]
Description=An interactive python notebook server
After=network.target

[Service]
ExecStart=/usr/bin/jupyter notebook\
    --no-browser\
 --port=8001\
@Rizwan-Hasan
Rizwan-Hasan / git-io-custom-url.md
Created December 21, 2020 16:22 — forked from dikiaap/git-io-custom-url.md
git.io custom URL

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
@Rizwan-Hasan
Rizwan-Hasan / Base64.js
Created February 14, 2021 12:42 — forked from alkaruno/Base64.js
Base64 encode & decode (only for numbers) in JavaScript
var Base64 = (function () {
var ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var Base64 = function () {};
var _encode = function (value) {
if (typeof(value) !== 'number') {
throw 'Value is not number!';
# Put this file in /etc/nginx/sites-available
# Then "ln -s /etc/nginx/sites-available/aria2-nginx.conf /etc/nginx/sites-enabled"
# Then "sudo service nginx restart"
server {
listen 80;
listen [::]:80;
root /var/www/aria2; # Put your aria2 web ui here, such as AriaNg
index index.html;
server_name DOMAIN_NAME;
location / {