Skip to content

Instantly share code, notes, and snippets.

View lucianmachado's full-sized avatar
:octocat:

Lucian lucianmachado

:octocat:
  • 22:57 (UTC -03:00)
View GitHub Profile
@lucianmachado
lucianmachado / gist:e5bc0928da572f898067814c305489c7
Created June 13, 2024 20:23
this fish function open one or multiple projects in vscode (using ghq to list projects)
function _fzf_open_project_in_code
fzf -m | xargs -I {} code {}
end
function fzf_open_project_in_code
begin
ghq list -p
echo $HOME/.config/fish
echo $HOME/.config/nvim
end | sed -e 's/\/$//' | awk '!a[$0]++' | _fzf_open_project_in_code $argv
@lucianmachado
lucianmachado / find_dir_sort_last_modified.sh
Created May 1, 2024 16:55
find directory matching with pattern and sort by last modified
find -maxdepth 5 -type d -name "projects" -prune -printf "%T@ %Tc %p\n" | sort -n
@lucianmachado
lucianmachado / polling.js
Created January 11, 2023 18:06 — forked from ivan-marquez/polling.js
Long polling implementation in Js
const axios = require('axios').default;
function getAPIClient() {
const axiosConfig = {
baseURL: 'https://csrng.net/csrng/csrng.php',
timeout: 5000,
};
return axios.create(axiosConfig);
}
@lucianmachado
lucianmachado / docker-compose.yml
Created April 20, 2022 13:10
docker-compose kafka with health check
version: "3.0"
services:
zookeeper:
image: confluentinc/cp-zookeeper
hostname: zookeeper
container_name: zookeeper
healthcheck:
test: nc -z localhost 2181 || exit -1
interval: 10s
@lucianmachado
lucianmachado / inject_component_service_angular.ts
Created April 15, 2021 00:20
Inject angular component by service
import {
ApplicationRef,
ComponentFactoryResolver,
ComponentRef,
EmbeddedViewRef,
Injectable,
Injector
} from '@angular/core';
@Injectable()
@lucianmachado
lucianmachado / git_utils.js
Created July 24, 2020 18:19
git utils javascript
const gitLogParser = require('git-log-parser');
const getStream = require('get-stream');
const execa = require('execa');
const {GIT_NOTE_REF} = ""
Object.assign(gitLogParser.fields, {hash: 'H', message: 'B', gitTags: 'd', committerDate: {key: 'ci', type: Date}});
/**
* Get the commit sha for a given tag.
*
@lucianmachado
lucianmachado / commit-msg
Created April 9, 2020 08:54
conventional commit hook bash
#!/bin/sh
COMMIT_MESSAGE=$(cat $1)
OUTPUT=$(echo $COMMIT_MESSAGE | awk '/^(build|ci|chore|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?(\!|\\\!)?: .*/');
if [[ ${#OUTPUT} -gt 0 ]]; then
exit 0;
else
echo "Mensagem de commit inválida. \n Consulte https://www.conventionalcommits.org/pt-br.";
exit 1;
fi
# Install these packages (use your favorite AUR tool here)
yay -S minikube-bin kubectl-bin docker-machine-driver-kvm2 libvirt qemu-headless docker-machine ebtables
# Get libvirt going
sudo systemctl enable libvirtd.service
sudo usermod -a -G libvirt $(whoami)
# This fix thanks to http://blog.programmableproduction.com/2018/03/08/Archlinux-Setup-Minikube-using-KVM/
sudo virsh net-autostart default
@lucianmachado
lucianmachado / cowsay.sh
Last active February 20, 2019 19:07
cowsay
#!/bin/bash
sudo apt-get install -y cowsay
cowsay "MUUU"
sudo shutdown -P now > /dev/null
@lucianmachado
lucianmachado / RESTdoc
Created February 6, 2019 03:06 — forked from coderofsalvation/RESTdoc
Quickndirty bash-utility to generate REST-documentation from sourcecode comments into css-styles html (or plainhtml). Can be handy for inclusion into phpdoc/phpdoctor/doxygen-dochains, instead of using heavyweight alternatives.
#!/bin/bash
#
# A quickndirty bash-utility to generate REST-documentation from sourcecode comments.
# (initially aimed at php-files, but js should also work)
# Basically its a c-style comment -> markdown -> html converter
# Dependancies:
# - awk
# - sed
# - bash
# - php