Skip to content

Instantly share code, notes, and snippets.

View Westixy's full-sized avatar
🐒

Esteban Sotillo Westixy

🐒
View GitHub Profile
@Westixy
Westixy / main.tf
Last active September 7, 2022 15:17
terraform vault role workaround
terraform {
required_providers {
vault = {
source = "hashicorp/vault"
version = "3.8.2"
}
}
}
# delay token creation
resource "time_sleep" "test" {
@Westixy
Westixy / vtree.mjs
Created April 30, 2021 10:32
Vault tree / find script in js
# Usage: node vtree.mjs <backend>[/path] [MAX_CALL_TO_VAULT_PER_CICLE]
# example: node vtree.mjs kv-store/some-subfolder | grep mysecret
import { spawn } from "child_process";
const BASE_PATH = process.argv[2];
const MAX_PER_CICLE = process.argv[3] || 100;
const listVault = (basePath) =>
new Promise((res, rej) => {
@Westixy
Westixy / gset.sh
Last active October 2, 2019 12:03
bash script to set value inside gopass using vim as editor (this is a little hack, some special chars can break it)
#!/bin/bash
# usage: gset.sh <GOPASS_KEY_PATH> <IDENTIFIER> <VALUE>
# set a unique value on an item
# for password use '-o' as key
GOPASS_KEY=$1
IDENT=$(echo "$2" | sed 's_/_\\\\/_g')
VALUE=$(echo "$3" | sed 's_/_\\\\/_g')
@Westixy
Westixy / konami.beautify.js
Last active September 13, 2018 19:56
konami code as one-liner and tricky for fun
(
(a, ks = '38384040373937396665', e = document.body, k = 0) =>
e.addEventListener('keydown', ke =>
+ks.slice(k*2,k*2+2) === ke.keyCode
? ++k >= ks.length/2
? a(e,k = 0)
: null
: k = 0
)
)(x => x.style.fontFamily = 'monospace')
@Westixy
Westixy / circularTime.ts
Last active August 15, 2018 04:40
circularTime
export default class CircularWaiter {
_canvas: any
_ctx: any
_intervalHandler: any
_timeLeft: number
_timeTodo: number
_cs: any
weight: number
_options: any
#!/bin/bash
if [[ -z "${CPNV_USERNAME}" ]]; then
echo You can define CPNV_USERNAME to avoid this step
echo -n 'Username: '
read username
else
username="${CPNV_USERNAME}"
echo "Username: $username"
fi
echo -n 'Password: '
class LogSharer {
constructor(project, api = 'http://172.17.102.83/api/projects/') {
this.config = { project, api }
}
get url() {
return this.config.api + this.config.project
}
sendData(data) {
let fd = new FormData()
fd.append('data',JSON.stringify(data))
@Westixy
Westixy / pos.js
Created February 15, 2017 21:38
Pos / vecteur
module.exports = class Pos {
static get version(){return '1.0.0';}
constructor(x,y,z) {
this.x=x;
this.y=y;
this.z=z||0;
}
get norme(){
return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);
}