Skip to content

Instantly share code, notes, and snippets.

View mendelgusmao's full-sized avatar
😅
what's up?

Mendelson Gusmão mendelgusmao

😅
what's up?
View GitHub Profile
let table = [...document.querySelectorAll('table[width="550"] > tbody')][1];
let items = [...table.querySelectorAll("tr")].map(
tr => [...tr.querySelectorAll("td")].map(
td => /good/.test(td.querySelector("img")?.src) || td.innerText || false
)
).map(
it => [it.slice(0, 2), it.slice(3, 5)]
)
.flat()
.filter(it => it.length);
/**
* Calcula o rendimento de poupança de um valor em um período específico.
*
* @param {value} input O valor a ser calculado.
* @param {initialDate} input Data inicial.
* @param {finalDate} input Data final.
* @return O valor corrigido.
* @customfunction
*/
function CORRECAO_POUPANCA(value, initialDate, finalDate = now()) {
minSpeed=1500
maxSpeed=5500
highTemp=70
normalTemp=40
output=/sys/devices/platform/applesmc.768/fan1_output
manual=/sys/devices/platform/applesmc.768/fan1_manual
currentSpeed=$(cat $output)
cache=/var/db/vwash.cache
touch $cache
while read line; do
mac=$(echo "$line" | cut -d: -f1-3)
if echo $mac | grep -i -e '[a-f0-9]\{2\}:' > /dev/null; then
lookup=$(grep "$mac=" $cache)
if [ $? -gt 0 ]; then
@mendelgusmao
mendelgusmao / main.go
Last active August 29, 2015 14:11
how many valid CPFs are there?
package main
import (
"fmt"
"runtime"
)
type CPF []int
func NewCPF(cpf int64) CPF {
@mendelgusmao
mendelgusmao / main.go
Last active November 5, 2022 12:57
.zsh_history merge+remove duplicate lines
package main
import (
"fmt"
"io/ioutil"
"os"
"regexp"
"sort"
"strconv"
"strings"
diff -rupN nginx-1.6.2/auto/modules nginx-1.6.2-socks-upstream/auto/modules
--- nginx-1.6.2/auto/modules 2014-09-16 09:23:19.000000000 -0300
+++ nginx-1.6.2-socks-upstream/auto/modules 2014-10-29 19:28:26.451597644 -0200
@@ -381,6 +381,11 @@ if [ $HTTP_UPSTREAM_LEAST_CONN = YES ];
HTTP_SRCS="$HTTP_SRCS $HTTP_UPSTREAM_LEAST_CONN_SRCS"
fi
+if [ $HTTP_UPSTREAM_SOCKS = YES ]; then
+ have=NGX_HTTP_UPSTREAM_SOCKS . auto/have
+ HTTP_SRCS="$HTTP_SRCS src/http/modules/ngx_http_upstream_socks_module.c"
#********************************************************************
# WARNING:: This whole exercise is performed while logged in as root.
# FOLLOW AT YOUR OWN RISK
#********************************************************************
# Setup a working directory anywhere you like. I'm using /vb/snakex.
mkdir /vb/snakex
cd /vb/snakex
export MYTOP=`pwd`
package xml
import (
"testing"
)
var (
fooXML = `
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root xmlns="urn:ietf:params:xml:ns:root-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:ietf:params:xml:ns:root-1.0 root-1.0.xsd">
@mendelgusmao
mendelgusmao / gist:6076361
Last active December 20, 2015 05:09
updates /etc/hosts whenever a host ip changes useful for creating host aliases usage: update-hosts <host_alias> <host_ip>
hosts=/etc/hosts
host=$1
ip=$2
if [ "$ip" = "" ]; then
ip=$(wget -qO- http://checkip.dyndns.org | cut -f2 -d":" | cut -f1 -d"<" | sed "s/ //")
fi
line=$(grep $host $hosts)