This file contains hidden or 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
version: "3.9" | |
services: | |
pg-latest: | |
container_name: pg-latest | |
image: postgres | |
environment: | |
- POSTGRES_PASSWORD=postgres | |
ports: | |
- "5432:5432" | |
volumes: |
This file contains hidden or 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
mongo-latest: | |
image: mongo | |
ports: | |
- "27017:27017" | |
volumes: | |
- mongo-data-latest:/data/db | |
# - `docker-compose up' to start MongoDB attached to the console, or `.. start' detached | |
# - Connect with `docker-compose run mongo-latest mongo HOSTIP/DBNAME' | |
# - `docker-compose stop' to stop the service if it was detached, |
This file contains hidden or 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
#!/usr/bin/env bash | |
# | |
# find-text: Find text or regex in a given path with context display, | |
# and omitting temp folders. | |
# | |
if [ "$1" == "-h" -o "$1" == "--help" ] | |
then | |
cat >&2 <<-'EOF' | |
find-text: find text or regex in a given path with context display, |
This file contains hidden or 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
#!/usr/bin/env bash | |
# | |
# find-css: Find one or two words (CSS markups) across CSS, SCSS or LESS files | |
# | |
if [ "$#" == 0 -o "$1" == "-h" -o "$1" == "--help" ] | |
then | |
cat >&2 <<-'EOF' | |
find-css: Find one or two words (CSS markups) across CSS, SCSS or LESS files | |
in the folder passed as first parameter. |
This file contains hidden or 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
-- Find all active connections (and idle) | |
SELECT | |
pid | |
,state | |
,datname | |
,usename | |
,application_name | |
,client_hostname | |
,client_port | |
,backend_start |
This file contains hidden or 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
# Find in the current folder (recursively) all the files with .xml extension. | |
find . -name '*.xml' | |
# Find all the __pycache__ files (or folders) and execute | |
# for each result the command `rm -r` with the filename as a first argument | |
find . -name "__pycache__" -print0 | xargs -0 rm -r | |
# Find into the /tmp folder files that the path matchs a regex expression | |
find /tmp -regextype posix-egrep -regex ".*\.(le|c)ss$" |
This file contains hidden or 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
# Get valid patterns from http://strftimer.com/ | |
>>> from datetime import datetime, date | |
>>> datetime.strptime("January 23, 2019", "%B %d, %Y") | |
datetime.datetime(2019, 1, 23, 0, 0) | |
>>> datetime.strptime("January 23, 2018", "%B %d, %Y").strftime("%Y-%m-%d") | |
'2018-01-23' | |
>>> datetime.strptime("2021-01-01T18:33:00Z", '%Y-%m-%dT%H:%M:%SZ') # The ISO format supported by Python does not parse dates ended with 'Z' |
This file contains hidden or 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
#!/usr/bin/env sh | |
# | |
# video2gif.sh | |
# | |
# See https://askubuntu.com/questions/648603/how-to-create-an-animated-gif-from-mp4-video-via-command-line | |
# | |
# Useful Params: | |
# | |
# -r Num of frames x sec | |
# -vf scale=512:-1 Scale up to 512, remove to preserve original resolution |
This file contains hidden or 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
#!/usr/bin/python3 | |
""" | |
Filter repeated JSON objects from a given JSON line file. | |
""" # noqa | |
import argparse | |
import json | |
import sys | |
parser = argparse.ArgumentParser( |
This file contains hidden or 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
#!/usr/bin/python3 | |
# | |
# Usage: ./msdos2utf8.py OLD_DOS_FILE NEW_ENCODED_FILE | |
# | |
# Creates a new file UTF-8 encoded, taking the input file as a file with old ASCII encoded used in MS-DOS systems. | |
# | |
# Try to replace 'cp437' with 'iso8859' if the new file isn't encoded properly | |
import sys |