Skip to content

Instantly share code, notes, and snippets.

View thiagokokada's full-sized avatar

Thiago Kenji Okada thiagokokada

View GitHub Profile
@thiagokokada
thiagokokada / test_runner.clj
Last active January 13, 2025 13:24
Babashka's test runner that dynamically discover the tests
#!/usr/bin/env bb
;; Inspired from https://book.babashka.org/#_running_tests
(require '[clojure.test :as t]
'[clojure.string :as string]
'[babashka.classpath :as cp]
'[babashka.fs :as fs])
(cp/add-classpath "src:test")
@thiagokokada
thiagokokada / is_tty.clj
Last active April 29, 2021 03:33
Python's os.isatty() function equivalent to Babashka
#!/usr/bin/env bb
(ns is-tty
(:require [babashka.process :as p]))
(defn- is-tty
[fd key]
(-> ["test" "-t" (str fd)]
(p/process {key :inherit :env {}})
deref
@thiagokokada
thiagokokada / download_bb_if_not_exist.clj
Last active May 28, 2021 22:36
Script that downloads Babashka if not available and runs the file as a Babashka script afterwards
#!/usr/bin/env bash
#_(
bb_dir="$HOME/.bb"
if [ ! -x "$bb_dir/bb" ]; then
echo "Babashka not found. Installing it at $bb_dir directory..."
download_dir="$(mktemp -d)"
trap "rm -rf $download_dir" EXIT
@thiagokokada
thiagokokada / shell.nix
Last active July 27, 2021 15:45 — forked from Mic92/shell.nix
Nix FHS env for OpenWrt
{ pkgs ? import <nixpkgs> {} }:
let
fixWrapper = pkgs.runCommand "fix-wrapper" {} ''
mkdir -p $out/bin
for i in ${pkgs.gcc.cc}/bin/*-gnu-gcc*; do
ln -s ${pkgs.gcc}/bin/gcc $out/bin/$(basename "$i")
done
for i in ${pkgs.gcc.cc}/bin/*-gnu-{g++,c++}*; do
ln -s ${pkgs.gcc}/bin/g++ $out/bin/$(basename "$i")
@thiagokokada
thiagokokada / LEIAME.md
Last active July 3, 2025 01:16
[Vivo Fibra] Usando RTF3507VW-N1 em modo bridge

[Vivo Fibra] Usando RTF3507VW-N1 em modo bridge

Por que usar o RTF3507VW-N1 em modo bridge?

O roteador Askey RTF3507VW-N1 fornecido pela Vivo tem vários problemas:

  • Existe um cache interno de DNS (usando o dnsmasq?) bugado: ao fazer a mesma requisição DNS duas vezes seguidas, a primeira resposta vem correta, porém na seguinte temos: