Skip to content

Instantly share code, notes, and snippets.

View AlbertSuarez's full-sized avatar
🙃
In the Upside Down

Albert Suarez AlbertSuarez

🙃
In the Upside Down
View GitHub Profile
@AlbertSuarez
AlbertSuarez / add_string_after_each_line.sh
Created September 17, 2021 08:12
add_string_after_each_line.sh
#!/usr/bin/env bash
sed -e 's/$/string after each line/' -i filename
@AlbertSuarez
AlbertSuarez / rename_jpeg_to_jpg.sh
Created May 27, 2021 11:11
rename_jpeg_to_jpg.sh
#!/usr/bin/env bash
rename 's/\.jpeg/\.jpg/' *.jpeg; rename 's/\.JPG/\.jpg/' *.JPG
@AlbertSuarez
AlbertSuarez / run_multiple_functions_in_parallel.py
Created October 7, 2020 12:33
run_multiple_functions_in_parallel.py
from threading import Thread
def run_in_parallel(*args):
threads = list()
num_args = len(args)
results = [None] * num_args
for idx in range(num_args):
function_target, function_args = args[idx]
threads.append(Thread(target=function_target, args=(results, idx) + function_args))
@AlbertSuarez
AlbertSuarez / rm_large_directory_efficiently.sh
Last active October 5, 2020 10:52
rm_large_directory_efficiently.sh
#!/usr/bin/env bash
mkdir empty_dir
rsync -a --delete empty_dir/ yourdirectory/ # Trailing slashes are mandatory.
@AlbertSuarez
AlbertSuarez / flat_folders_of_folders_to_single
Created August 27, 2020 09:08
flat_folders_of_folders_to_single.sh
#!/usr/bin/env bash
mv INPUT_FOLDER/*/**/*(.D) OUTPUT_FOLDER
@AlbertSuarez
AlbertSuarez / wget_from_csv.sh
Created August 26, 2020 09:43
wget_from_csv.sh
#!/usr/bin/env bash
for line in $(cat INPUT_FILE | cut -d "," -f1); do wget $line; done
@AlbertSuarez
AlbertSuarez / run_pgadmin4.sh
Created December 2, 2019 14:44
Run PgAdmin4 as a Docker container
docker run -p 5050:80 -e "PGADMIN_DEFAULT_EMAIL=email" -e "PGADMIN_DEFAULT_PASSWORD=password" -d dpage/pgadmin4
@AlbertSuarez
AlbertSuarez / run_swagger_editor.sh
Created September 17, 2019 10:05
Run Swagger editor locally
#!/usr/bin/env bash
docker pull swaggerapi/swagger-editor
docker run -d -p 80:8080 swaggerapi/swagger-editor
@AlbertSuarez
AlbertSuarez / svg_to_png.sh
Created September 14, 2019 10:52
Command-line application for converting SVG to PNG on Mac OS X
#!/usr/bin/env bash
qlmanage -t -s 1000 -o . picture.svg
@AlbertSuarez
AlbertSuarez / get_code_lines_github_repository.sh
Created July 12, 2019 14:21
Get amount of code lines from a GitHub repository
#!/usr/bin/env bash
git clone --depth 1 https://github.com/GITHUB_USER/GITHUB_REPOSITORY.git
cloc GITHUB_REPOSITORY
rm -rf GITHUB_REPOSITORY