Skip to content

Instantly share code, notes, and snippets.

View thiagosanches's full-sized avatar
🏠
Working from home

Thiago Sanches thiagosanches

🏠
Working from home
View GitHub Profile
@thiagosanches
thiagosanches / gist:bdd280099b913d169cc3
Created March 5, 2015 13:38
Regex pattern with powershell
$files = Get-Content "file_name_with_a_list_of_file_names"
foreach ($file in $files) {
select-string -Path $file -Pattern ">([0-9]+)" -AllMatches|%{$_.Matches[0].groups[1].value}
}
@thiagosanches
thiagosanches / my-windows-recipes
Last active January 26, 2018 00:24
my-windows-recipes
# Remove Windows Cortana
$path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search"
IF(!(Test-Path -Path $path)) {
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows" -Name "Windows Search"
}
Set-ItemProperty -Path $path -Name "AllowCortana" -Value 1
Stop-Process -name explore
# Enable Ubuntu on Windows 10
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
docker run --name zabbix-server-mysql -t \
-e DB_SERVER_HOST="mysql-server" \
-e MYSQL_DATABASE="zabbix" \
-e MYSQL_USER="zabbix" \
-e MYSQL_PASSWORD="zabbix_pwd" \
-e MYSQL_ROOT_PASSWORD="root_pwd" \
-e ZBX_JAVAGATEWAY="zabbix-java-gateway" \
--link mysql-server:mysql \
--link zabbix-java-gateway:zabbix-java-gateway \
-p 10051:10051 \
var fs = require('fs');
var sites = [];
var threshold = {
"performance": 0.90,
"accessibility": 0.95,
"seo": 0.90,
"pwa": 0
};
@thiagosanches
thiagosanches / git-revert-add-new-message.sh
Last active July 30, 2019 18:55
It's useful when you have to do some commits just to test, but it will not generate a lot of commit messages, since it's going "back" and generating a new commit
#!/bin/bash
# Important: Only use if you are working on a branch by yourself otherwise it will overwrite someone updates
git reset --soft HEAD~1 \
&& git add . && git commit -m "$1" \
&& git push --force origin
while true
do
FILENAME=$(date +%Y%m%d-%H-%M-%S.jpg)
curl "http://192.168.15.11/cam-hi.jpg" -o "$FILENAME" --silent
gsutil cp $FILENAME "gs://esp32cam-timelapse/$FILENAME"
sleep 1;
rm $FILENAME
done
# create the timelapse
ffmpeg -r 10 -pattern_type glob -i "*.jpg" -vcodec libx264 output.mp4
@thiagosanches
thiagosanches / aws-getter.sh
Last active October 3, 2021 15:18
aws-getter.sh
#!/bin/bash
# Run with source:
# source ./aws-getter.sh and you should be good - it will set your environment variable.
TEMP_FILE="/tmp/all-accounts.txt"
rm -rf $TEMP_FILE
cat ~/.aws/credentials | grep -E "\[.*?\]" | tr "[" " " | tr "]" " " | sort | uniq > $TEMP_FILE
INDEX=1