Skip to content

Instantly share code, notes, and snippets.

View paulolorenzobasilio's full-sized avatar

Paulo Basilio paulolorenzobasilio

View GitHub Profile
@paulolorenzobasilio
paulolorenzobasilio / docker-mountContainer
Created August 1, 2019 04:06
Mount the docker instance in the container to be able to use docker inside the container.
docker run -d -u root -v $(which docker):/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -t image/image:lts
@paulolorenzobasilio
paulolorenzobasilio / jenkins-docker_build_deploy
Last active August 2, 2020 17:19
Build & deploy a docker app using jenkinsfile
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage('Build'){
steps {
echo 'Building...'
script {
/**
* login to docker for private repository
@paulolorenzobasilio
paulolorenzobasilio / composer-remove
Created August 1, 2019 04:23
Remove composer cleanly.
rm -rf ~/.cache/composer
sudo rm -rf ~/.composer
sudo rm /usr/local/bin/composer
public class OutputArgument
{
public static void main (String[]args)
{
int[] source = { 1, 2, 3, 4, 5, 6 };
int[] destination = new int[6];
copyFromSourceToDestination (source, destination);
for (int i = 0; i < source.length; i++) {
System.out.println (destination[i]);
}
@paulolorenzobasilio
paulolorenzobasilio / post-merge
Last active August 19, 2019 23:33
Check changed files on post-merge and execute command
#!/usr/bin/env bash
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
changed() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
@paulolorenzobasilio
paulolorenzobasilio / gitlab-deploy-node.yml
Last active September 5, 2019 03:58
Sample node project deployment on Gitlab with caching of node_modules, test, build.
image: node:12.9.0-alpine
.ssh: &ssh
before_script:
- "which ssh-agent || ( apk update && apk add openssh-client )"
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *.$STAGING_ENV\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/knit.pem
@paulolorenzobasilio
paulolorenzobasilio / git-is-merged
Last active May 23, 2024 16:57
Check if source branch has been already merged into destination branch
#!/usr/bin/env bash
#
# Check if source branch has been already merged into destination branch
# https://stackoverflow.com/questions/226976/how-can-i-know-if-a-branch-has-been-already-merged-into-master
#
git_is_merged () {
merge_destination_branch=$1
merge_source_branch=$2
@paulolorenzobasilio
paulolorenzobasilio / destruct.md
Created November 12, 2019 00:46
Get subset of a JavaScript object properties
@paulolorenzobasilio
paulolorenzobasilio / directory-structure.md
Created January 9, 2020 01:44
Adding directory structure on readme

Directory Structure

Aerobatic defaults to some specific common front-end conventions. By conforming to these conventions you can simplify your configuration (convention over configuration).

Here is the basic suggested skeleton for your app repo that each of the starter templates conforms to:

├── app
│   ├── css
│ │ ├── **/*.css
'use strict';
const puppeteer = require('puppeteer');
(async () => {
/* PRECONDITION:
0. download ublock, I used https://github.com/gorhill/uBlock/releases/download/1.14.19b5/uBlock0.chromium.zip
1. run $PATH_TO_CHROME --user-data-dir=/some/empty/directory --load-extension=/location/of/ublock
2. enable block lists you want to use
*/