Skip to main content

Easy to use utilities: alerts, logging, running background processes, file and directory checking

Project description

Functions I've used accross multiple projects, more info in this README to come

#alert(alarm, x) counts down from x and prints int x and a string alarm to console

alert('Till countdown', 10)

#check_dir(child, parent) looks for a child directory in a parent directly, if there is no child dir then one is created 

check_dir('log', '~')

#check_file(fname, file_dest) ensures that a file is not in a directory, if it is not in the directory then the a path is provided for file creation 

check_file('somefile.txt', '~/projects')

#log_it(text, dest_dir) takes in string text and a string file destination folderand creates a file named with timestamp

log_it('this is a test', './log/')

#run_in_background(args) takes in a string shell command and runs it as a background process
 run_in_background('firefox')

#limit_proc(proc,limit) takes in a string process name and an int limit, limit represents a threshold of a certain process. If limit is reached then a simple spinlock activates and activly waits until the process count is no longer at the limit

limit_proc('curl', 5)

#kill_proc(proc) takes in a string process name and kills processes with that name

kill_proc('curl')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_utils-0.0.5.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file easy_utils-0.0.5.tar.gz.

File metadata

  • Download URL: easy_utils-0.0.5.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for easy_utils-0.0.5.tar.gz
Algorithm Hash digest
SHA256 af7c9286f64c5620afdfbe545f46c0206c5d783e99357ad628683f3930bdb346
MD5 313d30525a7d0755c2861622964972dc
BLAKE2b-256 2adf9b67d0875a9f5c6ca3f56e979f96f613f7bb8989f2f3ab52fcd7ea6e1709

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page