Skip to content

Instantly share code, notes, and snippets.

@chmeee
chmeee / get-latest-sgfs.sh
Last active February 1, 2024 14:04
Get latest SGF files from OGS
# OGS_ID es tu número de usuario (https://online-go.com/player/XXXXXXX)
# la secuencia genera números del 1 al 4 por defecto y cada página son 10 partidas
for i in $(seq 1 4); do
curl -sLk 'https://online-go.com/api/v1/players/'${OGS_ID}'/games/?ordering=-ended&page='$i \
| jq -r '.results[].related.detail'
done | while read game; do
echo $game
curl -sLk https://online-go.com/${game}/sgf -o $(basename $game).sgf
done
@chmeee
chmeee / upload-blob
Created November 12, 2019 14:03
Upload a blob to Azure
#!/usr/bin/env bash
if [[ $# != 3 ]]; then
echo "Cowardly refusing to run without exactly three arguments"
echo "Syntax: $0 key-string container-url file"
exit 1
fi
API_VERSION="2015-02-21"
DATE=$(TZ=GMT date +"%a, %d %b %Y %T %Z")
@chmeee
chmeee / get-batch-output
Last active November 1, 2019 09:14
Get output from an Azure batch execution
#!/usr/bin/env bash
if [[ $# != 2 ]]; then
echo "Cowardly refusing to run without exactly two arguments"
echo "Syntax: $0 key-string url"
exit 1
fi
API_VERSION="2019-08-01.10.0"
DATE=$(date +"%a, %d %b %Y %T %Z")
@chmeee
chmeee / create-federated-minikube-clusters.sh
Created August 19, 2019 18:08
Create federated Minikube clusters
# Create NUM_CLUSTER minikube clusters
if [[ -z $NUM_CLUSTER ]]; then
NUM_CLUSTER=2
fi
if [[ -z $VERSION ]]; then
VERSION=0.1.0-rc5
fi
@chmeee
chmeee / site.pp
Last active August 24, 2016 16:10
Roles association on site.pp
node 'puppet-database.intelliment-labs.com' {
include role::app1::database
}
node 'puppet-webserver.intelliment-labs.com' {
include role::app1::webserver
}
node 'itlm.example.com' {
# ...
itlm::requirement { 'network-to-backup':
source_ip => [ '10.0.42.0/24', '10.0.23.0/24' ], # network devices networks
dest_ip => '10.0.16.0/24', # backup network
ports => [ '6123/tcp', '6123/udp' ],
}
@chmeee
chmeee / list_wifis
Last active August 29, 2015 14:27 — forked from anonymous/list_wifis
One liner to list ESSID and Qualiity of Wi-Fi networks out of iwlist
tabs -40; sudo iwlist wlp3s0 scan | egrep "ESSID|Qual" | tac | sed -n 's/^\s*//g;N;s/\n/\t/;p' | sort -r -t= -k2; tabs -4
pdf2txt.py CIS_Microsoft_Windows_Server_2012_R2_Benchmark_v1.1.0.pdf | tr -d '\f' | sed -nr '/^[0-9]+\.[0-9]+/,/^$/p;/^Computer Configuration/,/^$/p;/^User Configuration/,/^$/p' | egrep -v '\.\.\.|CCE|^1\.0\.0|^1\.1.\0|P a g e' | cat -s | awk 'BEGIN { RS = ""; OFS = " "} {$1 = $1; print ; print '\n'}' > CIS_Microsoft_Windows_Server_2012_R2_Group_policies.txt
@chmeee
chmeee / paloalto_test.exp
Last active December 28, 2015 23:39
Script en expect para efectuar pruebas de reglas en cotafuegos Palo Alto.
#!/usr/bin/env expect
# Cada test debe ser de la forma:
# protocol XX from XX to XX source XX destination XX destination-port XX application XX
# protocol es obligatorio y puede ser 1 si es ICMP, 6 si es TCP, 17 si es UDP (ver /etc/protocols)
# destination-port es obligatorio
# application es opcional aunque conveniente si se sabe
# es conveniente indicar las zonas con from XX y to XX (es conveniente para evitar que se vaya por otra regla)
# El nombre del fichero se proporciona en el primer parámetro
@chmeee
chmeee / String.gsubh.rb
Created April 26, 2011 08:19
Makes substitution from a hash of regexp => subs
class String
def gsubh!(regexph)
regexph.each {|r, s| self.gsub!(r, s) }
self
end
end