Skip to content

Instantly share code, notes, and snippets.

View Abdur-rahmaanJ's full-sized avatar
🛰️
Python, for the love of it!

Abdur-Rahmaan Janhangeer Abdur-rahmaanJ

🛰️
Python, for the love of it!
View GitHub Profile
# Usage: python3 tldr_fail_test.py ${HOSTNAME}
#
# You can optionally pass the destination IP with --addr
#
# Author: davidben [at] chromium [dot] org
import argparse
import socket
import time
@j1o1h1n
j1o1h1n / words.css
Created August 31, 2022 10:00
A dictionary TUI written in python using the textual library - see https://asciinema.org/a/518081
Button {
padding-left: 1;
padding-right: 1;
}
TextInput {
layout: horizontal;
height: 3;
background: $panel-darken-1;
border: tall $panel-darken-2;
@MrSunshyne
MrSunshyne / Default (Linux).sublime-keymap
Created January 14, 2021 06:39
Sublime Text 3 User keymaps to have VS Code Keybindings
[
{ "keys": ["ctrl+shift+l"], "command": "find_all_under" },
{ "keys": ["ctrl+f2"], "command": "find_all_under" },
{ "keys": ["alt+shift+i"], "command": "split_selection_into_lines" },
{ "keys": ["ctrl+b"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+shift+b"], "command": "build" },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+shift+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["ctrl+shift+down"], "command": "select_lines", "args": {"forward": true} },
@tiran
tiran / python-on-debian.md
Last active May 21, 2024 08:46
Negative Python user experience on Debian/Ubuntu

Negative Python user experience on Debian/Ubuntu

The user experience of Python on a minimal Debian or Ubuntu installation is bad. Core features like virtual environments, pip bootstrapping, and the ssl module are either missing or do not work like designed and documented. Some Python core developers including me are worried and consider Debian/Ubuntu's packaging harmful for Python's reputation and branding. Users don't get what they expect.

Reproducer

The problems can be easily reproduced with official Debian and Ubuntu containers in Docker or Podman. Debian Stable (Debian 10 Buster) comes with Python 3.7.3. Ubuntu Focal (20.04 LTS) has Python 3.8.5.

Run Debian container

@arthurarty
arthurarty / PULL_REQUEST_TEMPLATE.md
Last active May 5, 2020 15:46
Pull request templated

Title of Pull Request

<!--- Provide a general summary of your changes in the Title above -->

Description

<!--- Describe your changes in detail -->

Motivation and Context

@ssghost
ssghost / exploring_word_vectors.ipynb
Created March 29, 2019 17:02
My answers for Stanford on-line course CS224N Winter 2019 Assignment-1.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fjsj
fjsj / sorted_list_intersection.py
Created December 14, 2018 17:54
Python fast sorted list intersection
import bisect
def bisect_index(arr, start, end, x):
i = bisect.bisect_left(arr, x, lo=start, hi=end)
if i != end and arr[i] == x:
return i
return -1
def exponential_search(arr, start, x):
if x == arr[start]:
@Dhrumilcse
Dhrumilcse / dictionary_4-1.py
Created November 18, 2018 08:08
Dictionary Part 4.1
#Import library
import json
# This is a python library for 'Text Processing Serveices', as the offcial site suggests.
import difflib
from difflib import SequenceMatcher
#Let's load the same data again
data = json.load(open("dictionary.json"))
#Run a Sequence Matcher
@lukassup
lukassup / zipapp.md
Last active September 12, 2023 02:17
Python zipapp

Python zipapp web apps

What's a zipapp?

This concept is very much like .jar or .war archives in Java.

NOTE: The built .pyz zipapp can run on both Python 2 & 3 but you can only build .pyz zipapps with Python 3.5 or later.

Initial setup

@yasinkuyu
yasinkuyu / check_internet.py
Last active January 4, 2021 10:57
Python Check Internet Connection
#@yasinkuyu 08/09/2017
def check_internet():
url='http://www.google.com/'
timeout=5
try:
_ = requests.get(url, timeout=timeout)
return True
except requests.ConnectionError:
print("İnternet bağlantısı yok.")