Skip to content

Instantly share code, notes, and snippets.

View humbhenri's full-sized avatar

Humberto Pinheiro humbhenri

View GitHub Profile
@humbhenri
humbhenri / toggle_gtk_theme.sh
Created April 26, 2025 13:38
Script to toggle gtk theme using command line, for window managers like i3
#!/usr/bin/env bash
CURR_THEME=$(gsettings get org.gnome.desktop.interface gtk-theme)
echo "gtk-theme = $CURR_THEME"
COLOR_SCHEME=$(gsettings get org.gnome.desktop.interface color-scheme)
echo "color-scheme = $COLOR_SCHEME"
if [ $CURR_THEME == "'Adwaita-dark'" ]; then
THEME=Adwaita
(ns p16
(:require [clojure.string :as str]))
(defn to-int[s]
(if (re-matches #"\d+" s)
(Integer/parseInt s)
s))
(defn parse-rule[rule]
(->> rule
@humbhenri
humbhenri / p11.go
Created December 11, 2020 18:11
advent of code 2020 problem 11 solution
package main
import (
"fmt"
"io/ioutil"
"log"
"reflect"
"strings"
)
@humbhenri
humbhenri / random_github_repo.sh
Last active September 16, 2019 00:03
Print a random github repo url from a query string
curl "$github/search/repositories?q=java%20rocks" | jq '.items[].url' | shuf -n1
@humbhenri
humbhenri / react_alura.sh
Created November 18, 2017 23:25
Executa Mysql via Docker e o jar do Projeto instalura do curso de React do Alura
SPRING_LOG_FILE=/tmp/spring_alura.log
rm $SPRING_LOG_FILE
docker stop alura
docker run --rm --name alura -e MYSQL_ROOT_PASSWORD=123 -p3306:3306 -d mysql:5.6
sleep 1
while ! docker logs alura 2>&1 | grep 'ready for connections'; do
sleep 1
echo Esperando mysql subir no container Docker...
@humbhenri
humbhenri / Matrix.java
Created February 23, 2016 18:15
Matrix chain multiplication using dynamic programming
package algo;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Random;
public class Matrix {
private int rows;
private int columns;
@humbhenri
humbhenri / cristiane
Created May 8, 2015 01:04
trabalho de banco de dados da Cristiane
CREATE TABLE Autores (
codigo int not null,
nome varchar(255),
nacionalidade varchar(255),
PRIMARY KEY (codigo)
);
CREATE TABLE Saloes (
numero int not null,
andar int,
#!/usr/bin/tclsh
# Read a configuration file
# http://rosettacode.org/wiki/Read_a_configuration_file
# Qui Mar 6 20:37:26 BRT 2014
# parameters to load
set fullname ""
set favouritefruit ""
set needspeeling no
set seedsremoved no
for {set i 3} {$i < 1000} {inc i} {if {$i % 3 == 0 || $i % 5 == 0} {set total [expr {$total + $i}]}}
IDENTIFICATION DIVISION.
PROGRAM-ID. EULERPROB1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 COUNTER PIC 9999 VALUE 1.
01 TOTAL PIC 9(6) VALUE 0.
01 REST PIC 999.
88 DIVISIBLE VALUE ZERO.