Skip to content

Instantly share code, notes, and snippets.

View hakuno's full-sized avatar

Seiji 誠 次 hakuno

  • Brazil
  • 14:26 (UTC -03:00)
View GitHub Profile
@hakuno
hakuno / gist:bdcca79a0d4f23dcfd6f0708dfe6c671
Created October 30, 2023 17:40
Detect which Terraform modules have changes at commit
git diff --name-only {{ circle_branch.stdout }} | \
xargs -n1 dirname | \
sort | \
uniq | \
xargs -I{} find ../../{} -maxdepth 1 -type f -name 'main.tf' ! -path '*.terraform*' | \
xargs -n1 dirname
@hakuno
hakuno / search.sh
Created January 19, 2022 03:39
Download logs from DataDog API
#!/bin/bash
DATADOG_API_KEY=ZZZ
DATADOG_APP_KEY=ZZZ
FILENAME=output
INDEX=0
response=$(curl -L -X POST "https://api.datadoghq.com/api/v2/logs/events/search" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: $DATADOG_API_KEY" \
-H "DD-APPLICATION-KEY: $DATADOG_APP_KEY" --data-raw '{
@hakuno
hakuno / Dockerfile
Created November 18, 2020 18:18
Alpine + iconv
# fix work iconv library with alphine
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted gnu-libiconv
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
@hakuno
hakuno / .makefile
Created November 12, 2020 17:42
Run Ansible Playbook in .makefile
# I found at https://dreisbach.us/articles/simple-ansible-makefile/
# Replace this
# ansible-playbook -i hosts --vault-password-file=.vault-password.txt site.yml
# For this
tags = $(subst roles/,,$(wildcard roles/*))
.PHONY: all $(tags)
all:
ansible-playbook -i hosts --vault-password-file=.vault-password.txt site.yml
$(tags):
@hakuno
hakuno / gist:c820364ec86619031867c9e907248023
Last active June 4, 2020 16:23
Make sure iptables and conntrack don't interfere with our traffic
Example
client$ iptables -I INPUT 1 --src 192.168.254.0/24 -j ACCEPT
client$ iptables -t raw -I PREROUTING 1 --src 192.168.254.0/24 -j NOTRACK
server$ iptables -I INPUT 1 --src 192.168.254.0/24 -j ACCEPT
server$ iptables -t raw -I PREROUTING 1 --src 192.168.254.0/24 -j NOTRACK
Example
receiver$ iptables -I INPUT 1 -p udp --dport 4321 -j ACCEPT
receiver$ iptables -t raw -I PREROUTING 1 -p udp --dport 4321 -j NOTRACK
Determinado usuário Linux tem "blank screen" após login.
sudo find . -type f -name "*displays*"
mv ~/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml ~/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml.bak
sudo reboot
OU
mv $(sudo find . -type f -name "*displays*") /opt/displays.xml.bak
@hakuno
hakuno / gist:08af35c10f72b1945371a86b1cee4e31
Last active August 14, 2019 20:38
Notes on Zabbix setup
*LOCALHOST|TEST PURPOSE ONLY*
# Exemplo 2
# Ou exemplo "Docker Compose"
https://www.zabbix.com/documentation/3.0/manual/installation/containers
# Link'em all
docker network create zabbix
# Banco de dados
@hakuno
hakuno / app.php
Created June 10, 2019 14:13
Lumen disables putenv
<?php
require_once __DIR__.'/../vendor/autoload.php';
// Look for
// https://github.com/laravel/lumen/pull/132
// PoC
// Illuminate\Support\Env::disablePutenv();
@hakuno
hakuno / update-minikube.sh
Last active June 7, 2019 12:32
Fedora Minikube Setup & Start with KVM2
#!/bin/bash
if ! [ -x "$(command -v docker)" ]
then
echo "⛔ Oh, my Gosh! You don't even have Docker on it."
exit 1;
else
sudo systemctl start docker
fi
if [ "$(egrep --color 'vmx|svm' /proc/cpuinfo)" == "" ]
It's useful whenever your lastest version of Fedora has no Docker on its repository.
For instance, Fedora 30 had no Docker (stable) available when released.
Then, you can go with the test version.
Prepare
sudo dnf -y update
sudo dnf -y install dnf-plugins-core