Skip to content

Instantly share code, notes, and snippets.

View Tes3awy's full-sized avatar
👨‍💻
Focusing

Osama Abbas Tes3awy

👨‍💻
Focusing
View GitHub Profile
@Tes3awy
Tes3awy / netmiko_threading_queuing.py
Last active February 14, 2024 11:40 — forked from consentfactory/netmiko_threading_queuing.py
Script to perform multithreading with Netmiko.
#!/usr/bin/python3
# Jimmy Taylor and Osama Abbas
# https://www.consentfactory.com/python-threading-queuing-netmiko/
# This method will spin up threads and process IP addresses in a queue
import os
import signal
# threading library
import threading
@Tes3awy
Tes3awy / tz-database-update.md
Last active April 28, 2023 11:57
Check and update tzdata

Check and update tzdata

Brief

The Egyptian government announced in March 2023 the return of DST (Daylight Saving Time). Thus, on April, 27th 23:59:59 midnight, this announcement will have an impact on all NTP-synced networks.

To begin with, since all time calculations on NTP servers are done in UTC (Coordinated Universal Time), a NTP server does not directly deal with time zones, but it does indirectly assist in maintaining accurate time across different time zones. By using NTP to synchronize the clocks of clients with an accurate UTC reference, it ensures that clients in different time zones have a consistent and accurate time base to work from. As you should never change time manually, unless there is no other way to do it, you need to let the NTP server handle this update to sync all clients within a network.

Fortunately, the TZ database is regularly updated. On March 28th, 2023 an update release (2023c) that handles the Egyptian DST change, was published on the inte

@Tes3awy
Tes3awy / serial_conn.py
Last active December 31, 2021 14:28 — forked from TannerRayMartin/serial_test1.py
Connecting to a Cisco switch via console cable through a serial port with a laptop using Python3 (pySerial)
__author__ = "Tanner Ray Martin & Osama Abbas"
__version__ = "1.1.0"
import time
import serial
# Creating your serial object
ser_conn = serial.Serial(
port="COM3", # COM is on windows, linux is different
@Tes3awy
Tes3awy / settings.md
Last active May 19, 2022 20:22
VSCode Native Bracket Pair Colorization

Native Bracket Pair Colorization in VSCode

Starting from VSCode v1.60, it is possible to colorize bracket pairs without using extensions, i.e natively, which is 10,000x faster that any other extension, only by setting few values in settings.json

If you want to know more on how native bracket pair colorization is developed, please refer to this official VSCode blog post that explains the cons of using an extension (such as Bracket Pair Colorizer 2) and the pros of using the native colorization option.

{
    // Controls whether bracket pair colorization is enabled or not (Default false)
    "editor.bracketPairColorization.enabled": true,
@Tes3awy
Tes3awy / asyncio.md
Created November 2, 2021 05:15 — forked from ipwnponies/asyncio.md
concurrent.futures (threading) vs. asyncio (event loop)

Summary

This gist demonstrates the difference between threading and asyncio. To be clear, they're both limited by the Global Interpreter Lock and are both single process, multi-threaded. They are both forms of concurrency but not parallelism.

Threading, via concurrent.futures

Threading (via Thread, concurrent.futures) employs time-slicing of CPU. All threads are given a slot of CPU time to do work. If the thread is blocking (sleeping or blocked on sockets), then off it goes to the next thread. With many threads that are blocked for long periods, this begins to degrade into polling (polling vs. interrupt)

@Tes3awy
Tes3awy / ansible-wsl.md
Last active February 18, 2022 19:50
Install Ansible (ansible [core 2.11.6]) on Windows Subsystem for Linux (WSL) and run your first playbook

Install Ansible release (Recommended)

The Windows Subsystem for Linux (WSL) is not officially supported by Ansible and should not be used for production.

$ sudo apt update && sudo apt upgrade -y
$ sudo apt install python3-pip git libffi-dev libssl-dev -y
$ pip3 install --user ansible pywinrm # pywinrm is a Python client for the Windows Remote Management (WinRM) service
@Tes3awy
Tes3awy / napalm-gather-configs.py
Last active February 12, 2024 10:04
A NAPALM Script to Gather All Configuration Types (Startup, Running, and Candidate if supported)
#!usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from datetime import date
from napalm import get_network_driver
from napalm.base.exceptions import ConnectionException
from paramiko.ssh_exception import SSHException
from rich import print
@Tes3awy
Tes3awy / sass-7-1-pattern.scss
Created August 1, 2019 12:17 — forked from rveitch/sass-7-1-pattern.scss
Sass 7-1 Pattern
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| ... # Etc…
|
|– components/
| |– _buttons.scss # Buttons
| |– _carousel.scss # Carousel
@Tes3awy
Tes3awy / gist:6dd5b45c1c6bbd8c673eb8421f4032c6
Last active September 24, 2017 15:09 — forked from bergantine/gist:5243223
CSS grayscale filter (go from grayscale to full color on hover) #css #sethneilson
/* At first the image is grayscaled by the filter and then on hover the filter is set to 0% */
img {
-moz-filter: grayscale(100%);
-o-filter: grayscale(100%);
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
-moz-transition: .5s ease-in-out;
-o-transition: .5s ease-in-out;
-webkit-transition: .5s ease-in-out;