Skip to content

Instantly share code, notes, and snippets.

View pssolanki111's full-sized avatar
😉

P S Solanki pssolanki111

😉
View GitHub Profile
@lrq3000
lrq3000 / pylistmodules.py
Last active September 17, 2023 19:27
List recursively all imports of modules along with versions done from your Python application. Tested on Python 2.7. No dependencies except standard Python libs.
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) 2001-2007 Martin Blais. All Rights Reserved
# Copyright (C) 2010 Bear http://code-bear.com/bearlog/
# Copyright (C) 2013 lrq3000
# Excerpt from SnakeFood to recursively list all imports of modules using AST parsing
# Additions to print the versions of each module if available
@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.")
@mondeja
mondeja / examples.py
Last active November 30, 2020 06:54
Python-to-Markdown magics line table generator
# DataFrame example
df = pd.DataFrame(data={'col1': ["one", 2], 'col2': [3, "four"]})
df = df.to_dict() # You need to pass as dict
%md table $df # <---- In Jupyter Notebook cell
#------------------------------------------------------------
# Dict structure example
from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.chrome.options import Options
import zipfile,os
def proxy_chrome(PROXY_HOST,PROXY_PORT,PROXY_USER,PROXY_PASS):
manifest_json = """
{
@ptmcg
ptmcg / song.py
Last active October 21, 2020 13:41
A familiar song
import time, sys, base64
for i, v in enumerate((getattr, time, sys, "sleep",
"decode", "bytes", "stdout",
"write", "flush", 1.0, 6,
base64, "upper", 1000.0, "'",
print, 0), start=3):
vars()['_'*i] = v
_ = (
b'RGFpc3kgRGFpc3kgZ2l2ZSBtZSB5b3VyIGFuc3dlciBk'
b'bwpJJ20gaGFsZiBjcmF6eSBhbGwgZm9y\nIHRoZSBsb3'
@souravrax
souravrax / mongodb_cheat_sheet.md
Created November 9, 2020 11:49 — forked from bradtraversy/mongodb_cheat_sheet.md
MongoDB Cheat Sheet

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

Provisioning an ARM EC2 Instance for TimescaleDB

SSH into instance

ssh -i ~path\to\key.pem -o TCPKeepAlive=true ubuntu@ec2-xx-xxx-x-xxx.us-[region]-[#].compute.amazonaws.com

Run general updates

sudo apt-get update