Read file line by line in PowerShell

Not much documentation on PowerShell loops. Documentation on loops in PowerShell is plentiful, and you might want to check out the following help topics: about_For, about_ForEach, about_Do, about_While. Another idiomatic PowerShell solution to your problem is to pipe the lines of the text file to the ForEach-Object cmdlet: Instead of regex matching inside the loop, you could pipe the lines through Where-Object to … Read more

Remove xticks in a matplotlib plot?

The plt.tick_params method is very useful for stuff like this. This code turns off major and minor ticks and removes the labels from the x-axis. Note that there is also ax.tick_params for matplotlib.axes.Axes objects.

Delete all local git branches

The ‘git branch -d’ subcommand can delete more than one branch. So, simplifying @sblom’s answer but adding a critical xargs: or, further simplified to: Importantly, as noted by @adminndrewC, using git branch for scripting is discouraged. To avoid it use something like: Caution warranted on deletes!

Best C# API to create PDF

Update: I’m not sure when or if the license changed for the iText# library, but it is licensed under AGPL which means it must be licensed if included with a closed-source product. The question does not (currently) require free or open-source libraries. One should always investigate the license type of any library used in a project. I have … Read more

print variable and a string in python

By printing multiple values separated by a comma: The print statement will output each expression separated by spaces, followed by a newline. If you need more complex formatting, use the ”.format() method: or by using the older and semi-deprecated % string formatting operator.