This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In my case files resided under empty_files folder | |
for file in empty_files/*; do | |
xmllint --format $file --output $file | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Problem: | |
# I had a Javadoc which automatically generated extra tags which I didn't need in all *.java files. | |
# Soltuion: | |
# Find all occurances and do in-place replacement in all files. | |
# In my case pattern was "@version $Id: $Id" but it can be anything | |
grep -rlZ '@version $Id: $Id' . | xargs sed -i '' 's/@version $Id: $Id//g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove docker containers | |
docker ps -a | cut -c 1-12 | tail -n +2 | xargs docker rm | |
# Remove docker images forcibly | |
docker images -a | cut -c 72-83 | tail -n +2 | xargs docker rmi -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example alias in Bash terminal | |
# alias rmmb='git branch --merged | egrep -v "(^\*|master)" | xargs git branch -d' | |
git branch --merged | egrep -v "(^\*|master)" | xargs git branch -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example alias in ~/.bash_profile | |
# alias pcb='git push origin $(git branch --show-current)' | |
git push origin $(git branch --show-current) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
def find_non_encodable_symbols(input_file, encoding_from, encoding_to): | |
with open(input_file, 'r', encoding=encoding_from) as file: | |
for row, line in enumerate(file): | |
for pos, symbol in enumerate(line): | |
try: | |
s = str(symbol).encode(encoding_to) | |
except: | |
print('Line: {0}'.format(line)) |