Skip to content

Instantly share code, notes, and snippets.

---
env:
contexts:
- name: "Local"
urls:
- "http://localhost:8001"
includePaths:
- "robots.txt"
parameters:
failOnError: true
@magmax
magmax / README.md
Last active December 13, 2022 13:52
Run Vault with persistence using docker compose

Instructions

  1. Ensure config.hcl file is in config directory
  2. run docker compose up -d
  3. run docker compose exec vault chown -R vault:vault /vault
  4. run docker compose exec vault apk add curl
  5. run docker compose exec vault curl --request POST --data '{"secret_shares": 1, "secret_threshold": 1}' http://127.0.0.1:8200/v1/sys/init
  6. Save the output from the previous command, what should look like:

{

#!/bin/bash
if [ ! -f "README.md" ]; then
(
echo "# FIXME"
echo
echo "Please, fill this file in"
) > README.md
fi
@magmax
magmax / models.py
Created August 15, 2011 07:54
Django: Creación de un site (models.py)
class blog(models.Model):
title = models.CharField(max_length=50)
body = models.TextField()
creation = models.DateField()
@magmax
magmax / settings.py
Created August 15, 2011 07:39
Django: configuración básica
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'database.db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}
@magmax
magmax / gist:1145865
Created August 15, 2011 07:42
Django: Ejecución del servicio básico.
$ python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
@magmax
magmax / gist:1145852
Created August 15, 2011 07:33
Django: Creación de un site.
$ django-admin startproject myblog
$ cd myblog
$ python manage.py startapp blog
$ tree
.
|-- blog
| |-- __init__.py
| |-- models.py
| |-- tests.py
| `-- views.py
@magmax
magmax / gist:1145573
Created August 15, 2011 01:38
Enumerados con sobreescritura en Java
public enum Enumerado {
item1(0) {
@Override
public void realizarTarea() {
// Aquí va el código
}
;
},
item2(1) {
@Override
@magmax
magmax / gist:1145562
Created August 15, 2011 01:25
Enumerado Java que implementa una interfaz
public enum Enumerado implements Serializable () {
item1(0),
item2(1),
item3(200),
;
private int value;
EnumeradoBasico(int v) {
this.value = v;
}
}