Skip to content

Instantly share code, notes, and snippets.

View leucos's full-sized avatar
👽
Waiting for aliens

Michel Blanc leucos

👽
Waiting for aliens
View GitHub Profile
@leucos
leucos / mover.sh
Created March 21, 2022 14:54
mover.sh (find + mmin version)
#!/bin/bash
set -eu
#
# This program watches new files and moves them from one machine to another
#
# How it works
#
# mover.sh will recursively watch old files in a directory using find. When the
@leucos
leucos / mover.sh
Last active March 9, 2022 21:56
This program moves files form one machine to another
#!/bin/bash
set -eu
#
# This program watches new files and moves them from one machine to another
#
# How it works
#
# mover.sh will recursively watch changes in a directory using inotifywait.
@leucos
leucos / passentropy.go
Created October 21, 2020 06:27
Get entropy for password
package main
import (
"fmt"
"syscall"
"golang.org/x/crypto/ssh/terminal"
passwordvalidator "github.com/lane-c-wagner/go-password-validator"
)
@leucos
leucos / main.go
Last active March 23, 2023 17:11
Vade Retro Spamcause (X-VR-SPAMCAUSE) Golang decoder
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("usage: spamcause gggruggvucft...")
@leucos
leucos / tempo.bash
Last active February 16, 2020 14:15
Send Twilio SMS on non-Blue EDF tempo days
#!/bin/bash
# This snippet will send a SMS when next EDF Tempo day is not Blue
# Better run this around noon
# https://particulier.edf.fr/fr/accueil/contrat-et-conso/options/tempo.html#/selection-bp
RTE_AUTH="xyz" # sbase64 auth token; ee https://data.rte-france.com/ for an account; then create an "App" for "Tempo Like Supply Contract"
TWILIO_ACCOUNT_ID="someid" # see https://www.twilio.com/console
TWILIO_AUTH_TOKEN="sometoken" # see https://www.twilio.com/console
FROM_PHONE="+33999999" # phon# to send from, see https://www.twilio.com/console
@leucos
leucos / pre-commit.sh
Last active August 29, 2019 08:26 — forked from radlinskii/pre-commit.sh
This is a pre-commit hook file for working in Go. Be sure to save this file in your repository as `.git/hooks/pre-commit` and give it right to execute e.g. with command `chmod +x .git/hooks/pre-commit`
#!/bin/bash
STAGED_GO_FILES=$(git diff --cached --name-only -- "\.go$")
if [[ "$STAGED_GO_FILES" = "" ]]; then
exit 0
fi
GOLINT=$GOPATH/bin/golint
GOIMPORTS=$GOPATH/bin/goimports
@leucos
leucos / ansible-role-test.sh
Last active September 13, 2018 08:08 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
@leucos
leucos / keybase.md
Created November 22, 2017 16:57
Keybase proof

Keybase proof

I hereby claim:

  • I am leucos on github.
  • I am leucos (https://keybase.io/leucos) on keybase.
  • I have a public key ASD5ci-OAGGxbyDvDxpVlTnsWBzkBjsMgufONqXDlvbaDwo

To claim this, I am signing this object:

#!/bin/bash
# ran vi @hook post
DOCKER_RULES_DIR=/tmp/ferm
for table in ${DOCKER_RULES_DIR}/*; do
iptables-restore -n ${table}
done
@leucos
leucos / databases_sizes.sql
Created August 4, 2016 10:27
Get mysql databases sizes
SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB",
engine "Engine"
FROM information_schema.TABLES
GROUP BY table_schema;