Python Lambda Functions - Quick Notes
Lambda functions: are anonymous functions with no function name but with function body or definition are useful when a small function is expected to be called once or just a few times are useful as...
View ArticlePython Object Persistence Module, pickle — Quick Notes
Pickling or serialization is the process of converting a Python object to a byte stream; and Unpickling or deserialization is the process of re-creating the original in-memory Python object (not...
View ArticlePerl: Enabling Features
By default new features are not enabled in Perl mainly to retain backward compatibility. Starting with release 5.10, latest features have to be enabled explicitly before using them. Here are a few ways...
View ArticleBlast from the Past : The Weekend Playlist #16
Audio & Widget courtesy: SpotifyOld playlists: #1 #8 #14(50s, 60s and 70s) | #2 #3 #4 #5(80s) | #6 #7 #9(90s) | #11 #12(00s) | #13(10s) | #10(Instrumental)...
View ArticleParsing JSON on Command Line or in a Shell Script
Couple of options:1. If you do not have the flexibility of installing new utilities, or simply prefer working with existing tools, one option to consider is to make use of Python's JSON module.One or...
View ArticleBlast from the Past : The Weekend Playlist #17 — Michael Jackson Special
The King of Pop needs no special introduction so here goes.This playlist features music from five different albums of MJ -- Off the Wall (1979), Thriller (1982; "Best-selling album" in Guinness World...
View ArticleShell Scripting: Few Tidbits #1
Length of a String Stored in a Variable${#VARIABLE} eg., $ FRUIT="Orange"$ echo ${#FRUIT}6In bash, variables that store values are known as parameters. Ref: Bash Reference Manual -> Shell Parameter...
View ArticleShell Scripting: Few Tidbits #2
Shell Scripting Tidbits: #1Extracting the filename and extension from an absolute patheg.,Input: abspath="/var/tmp/localuserinfo.out"Filename with extension:$ basename...
View ArticlePython Notes #1
Shuffling List ElementsTry shuffle method in random module.shuffle() modifies the original sequence. In other words, shuffling happens in place and the function returns None.To shuffle an immutable...
View ArticleBlast from the Past : The Weekend Playlist #18 — New Wave 80s
Audio & Widget courtesy: SpotifyOld Playlists: #1 #8 #14(50s, 60s and 70s) | #2 #3 #4 #5(80s) | #6 #7 #9 #16(90s) | #11 #12(00s) | #13(10s) |...
View Articlepip error: Could not find an activated virtualenv (required)
Running pip commands encounter Could not find an activated virtualenv (required) error. Some of the options to get around this error are discussed in this blog post.eg.,# pip uninstall ociERROR: Could...
View ArticlePerl: Handling Signals
Signals are used to notify processes of a synchronous or asynchronous event. When a signal is sent, operating system interrupts the flow of execution of target process to deliver the signal. If the...
View ArticleShell Scripting: Tidbits #3
[1] Check if the content of file X is in another file YOne option is to rely on comm utility to compare common lines in both files. comm requires both files to be sorted.comm utility produces three...
View ArticleShell Scripting: Tidbits #4
[1] Check if a String Starts with Substring or a Wildcard PatternReproducing from Advanced Bash-Scripting Guide ->Chapter 7. Tests.The == comparison operator behaves differently within a...
View ArticleRandom Linux & Shell Command Tips - rpm, ss, kill, zip
Some of these tips are applicable only on Linux. (1) List all files in an uninstalled RPMTry any of the following.rpm -qlp rpm -qilp rpm2cpio | cpio -t(2) Extracting a specific file from an RPMSteps:...
View Article