Skip to content

Instantly share code, notes, and snippets.

@calexandre
calexandre / scoop-packages.ps1
Last active Sep 2, 2020
My windows scoop packages
View scoop-packages.ps1
# 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
View Microsoft.PowerShell_profile.ps1
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 / readme.md
Last active May 16, 2021
Tasmota Cheat Sheet
View readme.md
@calexandre
calexandre / merge-zsh-history.sh
Last active May 3, 2021
Merge two zsh history files
View merge-zsh-history.sh
#!/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 / script.js
Last active Feb 22, 2021
script para acelerar o processo de classificação no site e-factura
View script.js
/* Como executar:
* 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
*/
// Manutenção e reparação de veículos automóveis: C01
// template: jQuery("td:contains('XXXXXXXXXXXXX')").closest("tr").find("button[value='C01']").click();
// Motos: C02
// template: jQuery("td:contains('XXXXXXXXXXXXX')").closest("tr").find("button[value='C02']").click();
@calexandre
calexandre / docker-prune.sh
Last active Mar 4, 2019
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.
View docker-prune.sh
(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
View docker-prune.sh
(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 / macro.txt
Last active Aug 29, 2015
Portugal LDA - Macro
View macro.txt
/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}.
View Log4netTraceListener.cs
public class Log4netTraceListener : TraceListener
{
public override void Write(object o)
{
base.Write(o);
}
public override void WriteLine(string message)
{
this.Write(message);