Skip to content

Instantly share code, notes, and snippets.

View emilorol's full-sized avatar

Emil Orol emilorol

  • Miami, FL
View GitHub Profile
@shakyaabiral
shakyaabiral / bumpversion.php
Last active August 17, 2023 16:06
Bumpversion for php application
<?php
/*
* Creates a VERSION file if not exists in current directory.
* Version should be in the format. {Major.Minor.Patch}
* Patch has a suffix -dev for non release version
* Usage:
* php bumpversion.php [options]
* options:
* --version [part] (required)
@kumbasar
kumbasar / jenkins_delete_builds.groovy
Last active June 10, 2021 17:07 — forked from pkouman/jenkins_delete_builds.groovy
Jenkins - Delete old builds script
MAX_BUILDS = 10 // max builds to keep
def jobs = Jenkins.instance.items;
for (job in jobs) {
println "Job: " + job.name
try {
if(job instanceof jenkins.branch.MultiBranchProject) {
println "Multibranch"
job = job.getJob("master")
@tamasgal
tamasgal / ParallelDockerJenkinsfile
Last active December 26, 2023 12:41
Looping through a list of docker images and execute their stages in parallel. More info here: https://stackoverflow.com/questions/49782267/running-multiple-docker-containers-from-a-single-jenkinsfile
def docker_images = ["python:2.7.14", "python:3.5.4", "python:3.6.2"]
def get_stages(docker_image) {
stages = {
docker.image(docker_image).inside {
stage("${docker_image}") {
echo 'Running in ${docker_image}'
}
stage("Stage A") {
switch (docker_image) {
@legege
legege / scan-assets.groovy
Created March 22, 2018 19:06
Nexus 3 assets scan
import org.apache.commons.io.FileUtils
import org.sonatype.nexus.repository.storage.Asset
import org.sonatype.nexus.repository.storage.Component;
import org.sonatype.nexus.repository.storage.Query
import org.sonatype.nexus.repository.storage.Query.Builder;
import org.sonatype.nexus.repository.storage.StorageFacet
def repo = repository.repositoryManager.get('releases')
StorageFacet storageFacet = repo.facet(StorageFacet)
@varunon9
varunon9 / Category.php
Created January 16, 2018 18:18
Implementing Naive Bayes Classification algorithm into PHP to classify given text as ham or spam. To see complete project visit: https://github.com/varunon9/naive-bayes-classifier
<?php
class Category {
public static $HAM = 'ham';
public static $SPAM = 'spam';
}
?>
@bknopper
bknopper / purge-nexus.groovy
Created November 30, 2017 10:01
Groovy script for Nexus 3 to purge old releases
import org.sonatype.nexus.repository.storage.StorageFacet;
import org.sonatype.nexus.repository.storage.Query;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
def fmt = DateTimeFormat.forPattern('yyyy-MM-dd HH:mm:ss');
[
'releases'
].each { reponame ->
// Get a repository
@nathobson
nathobson / b2-backup.sh
Last active August 30, 2023 15:20
Ansible role for backuping up to Backblaze B2
#!/bin/sh
cd ../
B2_BUCKET_NAME="example-com"
INSTALL_NAME="example.com"
SQL_FILE=database_backup.sql
UPLOADS_FILE=uploads_backups.tar.gz
UPLOADS_DIR=/srv/www/$INSTALL_NAME/shared/
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@facine
facine / __INDEX.txt
Last active August 28, 2024 05:45
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes:
@aczietlow
aczietlow / selenium-php-webdriver-cheatsheet.md
Last active September 12, 2024 04:08 — forked from huangzhichong/selenium-webdriver-cheatsheet.md
Cheat sheet for using php webdriver (facebook/webdriver).

Webdriver PHP API workthough

  • Open a browser

    # start an instance of firefox with selenium-webdriver
    
    $browser_type = 'firefox'
    $host = 'http://localhost:4444/wd/hub'
    

$capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => $browser_type);