Skip to content

Instantly share code, notes, and snippets.

View dimitriacosta's full-sized avatar

Dimitri Acosta dimitriacosta

View GitHub Profile
@dimitriacosta
dimitriacosta / docker-compose.yml
Created August 1, 2021 19:02
Jenkins docker-compose file
version: "3"
services:
docker:
container_name: jenkins-docker
image: docker:dind
privileged: true
networks:
jenkins:
aliases:
- docker
@dimitriacosta
dimitriacosta / str2bool.py
Created January 9, 2021 22:00
Convert string to boolean values
def str2bool(val):
"""Converts string to boolean value"""
if isinstance(val, bool):
return val
if val.lower() in ("yes", "y", "true", "t", "1"):
return True
if val.lower() in ("no", "n", "false", "f", "0"):
return False
raise argparse.ArgumentTypeError("Boolean value expected.")
@dimitriacosta
dimitriacosta / pings.sh
Created April 8, 2020 15:50
Check multiple hosts to see if they are reachable
#!/usr/bin/env bash
# Verifies that a hosts.txt file exists
# This file should contain a list of IP to pinged
if [[ ! -e ./hosts.txt ]]; then
echo "Error: The file hosts.txt doesn't exists in this directory." >&2
exit 1
fi
TIMESTAMP=$(date -u +%FT%T)
@dimitriacosta
dimitriacosta / .phpcsfixer
Created September 3, 2018 07:47
Custom configuration for php-cs-fixer
<?php
return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'no_unused_imports' => true,
'ordered_imports' => [
'imports_order' => null,
'sort_algorithm' => 'length',
@dimitriacosta
dimitriacosta / .gvimrc
Last active November 25, 2022 15:08
Vim Settings
if has("gui_running")
" Add a little space to the line number column
set foldcolumn=2
" Set the background of the line number to match the theme background
hi LineNr guibg=bg
" Set the background color for the foldcolumn to match the theme background
hi foldcolumn guibg=bg
" Remove splits separators
hi VertSplit guifg=bg guibg=bg
" Use the tallest window as possible
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_style": "solid",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
@dimitriacosta
dimitriacosta / laramagic
Last active August 1, 2021 19:20
Creates a new laravel project, initializes a git repository, creates its database and open in browser and editor
function laramagic {
PROJECT=$1
echo "Creating a new Laravel project: $PROJECT..."
cd ~/code
composer create-project laravel/laravel $PROJECT
cd $PROJECT
git init
git add .
git commit -m "Install Laravel"
mysql -u root -e "CREATE DATABASE $PROJECT"