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
// The following script will blindly clone all Gitlab CI variables from source repository to the target. Created this to move CI from my own repository to a client's own. | |
// Update the project_id/api_key (and url's if needed below), install the dependency "npm i node-fetch" and then run using node clonecivariables.mjs | |
import fetch from 'node-fetch'; // run in the same dir as the script: npm i node-fetch | |
const source_project_id = ''; // can be found on repository's home page under the repository name. | |
const source_api_key = '' // get one here https://gitlab.com/-/profile/personal_access_tokens (create a personal token with API scope) | |
const source_url = 'https://gitlab.com/'; // only need to change this if using self-hosted gitlab | |
const target_project_id = ''; |
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
/* coverts process durations output from the ps linux command in the [[dd-]hh:]mm:ss format to seconds | |
* useful when you need to find long running processes in PHP | |
*/ | |
function posixTimeToSeconds($str) { | |
$parts = explode(':', $str); | |
$c = count($parts); | |
if ($c == 2) { | |
return (int)$parts[0] * 60 + (int)$parts[1]; | |
} else if ($c == 3) { |