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
| #!/bin/bash | |
| # check_and_run_container_from_crontab.sh | |
| # chmod +x check_and_run_container_from_crontab.sh | |
| # @reboot /path/to/check_and_run_container_from_crontab.sh my_container_name | |
| container_name=$1 | |
| if docker container inspect "$container_name" &>/dev/null; then | |
| echo "Container $container_name already exists, checking status..." | |
| if $(docker inspect -f '{{.State.Status}}' "$container_name" | grep -q "running"); then |
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
| #!/bin/bash | |
| # To check if a Docker container exists, you can use | |
| # the docker ps command. However, it only shows the running containers. | |
| # If you want to check if a container with a specific name exists, | |
| # regardless of whether it is running or not, you can use | |
| # the docker inspect command. It will return information about the container, | |
| # and if it does not exist, it will return an error. |
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
| #!/bin/bash | |
| # This script can copy or move files from one folder to another, | |
| # removing special characters in file names that can cause file system | |
| # inconsistencies | |
| # HOW TO USE: | |
| # 1. Open a terminal and navigate to the directory containing the script file. | |
| # 2. Make the script executable by running the following command: | |
| # -> chmod +x bkpfiles.sh |
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
| var collection = [ | |
| {item: "lapiz", cost: 10.2, vendor: "mari"}, | |
| {item: "lapiz", cost: 11.2, vendor: "maris"}, | |
| {item: "lapiz", cost: 8.24, vendor: "maris"}, | |
| {item: "lapiz", cost: 8.232, vendor: "maris"}, | |
| {item: "lapiz", cost: 8.23198, vendor: "maris"}, | |
| {item: "lapiz", cost: 8.23199, vendor: "maris"}, | |
| {item: "lapiz", cost: 8.25, vendor: "maris"}, | |
| {item: "lapiz", cost: 8.256, vendor: "maris"}, | |
| {item: "lapiz", cost: 9, vendor: "mariss"}, |
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
| /** | |
| * This will parse a delimited string into an array of arrays. | |
| * The default delimiter is the comma, but this can be | |
| * overriden in the second argument. | |
| * | |
| * ref: http://stackoverflow.com/a/1293163/2343 | |
| * | |
| * @param {String} strData | |
| * @param {String} strDelimiter | |
| */ |
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
| /** | |
| * Creates an array of elements split into groups the length of size. | |
| * If array can't be split evenly, the final chunk will be the remaining elements. | |
| * | |
| * Usage: | |
| * [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19].chunk(4) | |
| * | |
| * @return (5) [Array(4), Array(4), Array(4), Array(4), Array(4)] | |
| */ | |
| Array.prototype.chunk = function (size = 0) { |
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
| /** | |
| * Obtiene los valores de un string que proceden después de dos puntos: | |
| * | |
| * @return (2) ["file", "csv,xls,xlsx"] | |
| */ | |
| 'file:csv,xls,xlsx'.match(/(?:[^:*]+)/gi) |
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
| 'use strict'; | |
| /** | |
| * Below is an example function that takes two sets of | |
| * longitude and latitude co-ordinates and returns the | |
| * distance between the two. | |
| * | |
| * http://www.codecodex.com/wiki/Calculate_distance_between_two_points_on_a_globe | |
| */ | |
| var getDistance = function (lat1, lon1, lat2, lon2) { |
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
| var regexpCatalog = { | |
| rule: /^(.+?)\[(.+)\]$/, | |
| numeric: /^[0-9]+$/, | |
| integer: /^\-?[0-9]+$/, | |
| decimal: /^\-?[0-9]*\.?[0-9]+$/, | |
| email: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, | |
| alpha: /^[a-z]+$/i, | |
| alpha_numeric: /^[a-z0-9]+$/i, | |
| alpha_dash: /^[a-z0-9_\-]+$/i, | |
| natural: /^[0-9]+$/i, |
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
| var getCoordinatesFromValue = function (value) { | |
| // extract coordinates from value: | |
| var regexp = /@(-?\d+\.\d+),(-?\d+\.\d+),(\d+\.?\d?)+z/g; | |
| if (regexp.test(value) == true) { | |
| // check if value comes from google maps URL: | |
| value = value.match(regexp); | |
| if (value) { | |
| // value has not empty: | |
| value = value.join('').split(','); | |
| value.pop(); |
NewerOlder