Skip to content

Instantly share code, notes, and snippets.

View calexandre's full-sized avatar
:shipit:
🤘

Carlos Alexandre calexandre

:shipit:
🤘
View GitHub Profile
public class Log4netTraceListener : TraceListener
{
public override void Write(object o)
{
base.Write(o);
}
public override void WriteLine(string message)
{
this.Write(message);
@calexandre
calexandre / macro.txt
Last active August 29, 2015 14:22
Portugal LDA - Macro
/2 {skull} Portugal LDA {skull} a recrutar malta para HFC (670 min ilvl). Todas as candidaturas sao analisadas com pormenor. {star} Raidamos regularmente em ambiente descontraido mas responsável {star}.
(docker container prune -f --filter "until=24h" && docker volume prune -f && docker image prune -f -a --filter "until=24h") | ts "[%Y-%m-%d %H:%M:%S]" >> /var/log/docker-curator/docker-curator.log 2>&1
@calexandre
calexandre / docker-prune.sh
Last active March 4, 2019 10:16
The following script executes a docker prune command and outputs the result to a log file. If the exit code is different from 0, it will output the result to stdout. This is very useful for crontabs since you'll only get alerted when the scripts write to the stdout.
(docker container prune -f --filter "until=24h" && docker volume prune -f && docker image prune -f -a --filter "until=24h") | ts "[%Y-%m-%d %H:%M:%S]" >> /var/log/docker-curator/docker-curator.log 2>&1
@calexandre
calexandre / script.js
Last active February 11, 2024 13:42
script para acelerar o processo de classificação no site e-factura (usado em 2022)
/* Como executar:td:icontains
* Abrir o site na página das faturas a classificar e abrir a consola javascript nas DevTools.
* Copy & Paste do código js e executar para cada página
*/
// comparação case insensitive
jQuery.expr[':'].icontains = function(a, i, m) {
return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};
@calexandre
calexandre / merge-zsh-history.sh
Last active April 3, 2024 14:11
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@calexandre
calexandre / readme.md
Last active February 8, 2022 15:12
Tasmota Cheat Sheet
@calexandre
calexandre / Microsoft.PowerShell_profile.ps1
Created September 2, 2020 12:17
My powershell profile
Invoke-Expression (&starship init powershell)
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# enable completion in current shell, use absolute path because PowerShell Core not respect $env:PSModulePath
Import-Module "$($(Get-Item $(Get-Command scoop).Path).Directory.Parent.FullName)\modules\scoop-completion"
@calexandre
calexandre / scoop-packages.ps1
Last active September 2, 2020 12:22
My windows scoop packages
# Add scoop buckets
scoop bucket add extras
scoop bucket add scoop-completion https://github.com/Moeologist/scoop-completion
# Install scoop packages
scoop install 7zip
scoop install starship
scoop install keepass
scoop install keepass-plugin-keeanywhere
scoop install openssl
@calexandre
calexandre / main.tf
Last active August 20, 2021 13:12
GCP DNS mass creation with Terraform
locals {
# the default is important in case you need it elsewhere (it points to the first zone created)
dns_default_zone = "my-dns-zone"
dns_default_fqdn = "${local.dns_default_zone}.${data.google_dns_managed_zone.parent[local.dns_default_zone].dns_name}"
dns_zones = {
"${local.dns_default_zone}" = {
parent_zone_name = "my-parent-dns-zone"
}
}
}