Skip to content

Instantly share code, notes, and snippets.

View iSignal's full-sized avatar

Sanketh I iSignal

  • Bay Area, California
View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@fillest
fillest / better-than-bash-scripts.py
Last active October 18, 2023 19:11
No more unmaintainable error-prone Bash scripts - use this instead
# Bash really should be avoided as much as possible (within reasonable limits, of course) even for one-liners which *seem* trivial.
# Bash is very error-prone by design. It's hard to comprehend all the pitfalls (e.g. https://mywiki.wooledge.org/BashFAQ/105)
# and it's a regrettable time-waste anyway.
#
# Modern Python is good for scripting the logic - keep Bash only for launching executables and most primitive
# pipes and redirections (avoid subshells, substitutions and so on). No need to install anything -
# just start your script with the following small self-contained helper function (check the examples for usage). Its features:
# * terminates on non-zero exit status by default
# * returns the output (combined - which usually should not be a problem - use e.g. '2>/dev/null' when it is)
# * prints commands and combined output
# pip install yb-cassandra-driver
from cassandra.cluster import Cluster
import time
import random
from multiprocessing.dummy import Pool as ThreadPool
# Load Phase params
num_write_threads=4
num_users=500
@willurd
willurd / web-servers.md
Last active April 18, 2024 14:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000