Skip to content

Instantly share code, notes, and snippets.

View brycepg's full-sized avatar

Bryce Guinta brycepg

View GitHub Profile
@jtriley
jtriley / terminalsize.py
Created July 26, 2011 21:58
Get current terminal size on Linux, Mac, and Windows
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@jottr
jottr / readline_shortcuts.md
Last active July 19, 2024 19:02
readline shortcuts

Readline

GNU readline is a commonly used library for line-editing; it is used for example by Bash, FTP, and many more (see the details of [readline][5] package under "Required By" for more examples). readline is also customizable (see man page for details).

Keyboard Shortcut Description

Ctrl+l Clear the screen

Cursor Movement

@algotrader-dotcom
algotrader-dotcom / Selenium webdriver wait for ajax with Python
Created December 10, 2015 06:05
Selenium webdriver wait for ajax with Python
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import WebDriverException
def ajax_complete(driver):
try:
return 0 == driver.execute_script("return jQuery.active")
except WebDriverException:
pass
@luiscape
luiscape / install_packages.sh
Created January 16, 2017 14:36
Install Python dependency packages from requirements.txt using conda.
#
# Original solution via StackOverflow:
# http://stackoverflow.com/questions/35802939/install-only-available-packages-using-conda-install-yes-file-requirements-t
#
#
# Install via `conda` directly.
# This will fail to install all
# dependencies. If one fails,
# all dependencies will fail to install.
@brycepg
brycepg / ip.sh
Last active July 10, 2021 01:26
Get IP Address from hostname bash function
# Get IP address from hostname using Python
# Args:
# $1 - hostname
# Returns:
# The ip address
ipfromhostname() {
local hostname="$1"
if [ -z "$hostname" ]; then
>&2 echo 'Must supply hostname as an argument'
return 1