vault with docker

doker-compose.yml file version: ‘3’ services: vault: image: vault container_name: vault ports: – 8200:8200 volumes: – ./data:/vault/data:rw – ./config:/vault/config:rw cap_add: – IPC_LOCK entrypoint: vault server -config=/vault/config/vault.conf vault.conf ui = true storage “file” { path = “/vault/data” } listener “tcp” { address = “0.0.0.0:8200” tls_disable = 1 #tls_disable = 0 #tls_cert_file = “/vault/conf/cert/fullchain.pem” #tls_key_file = “/vault/conf/cert/privkey.pem” }Continue reading “vault with docker”

Digispark lock button

Ok here is the code for locker button. The main feature of this device is to lock the screen of the computer when you leave the office. #include “DigiKeyboard.h” const int buttonPin=0; int buttonState=0; void setup() { DigiKeyboard.update(); DigiKeyboard.sendKeyStroke(0); pinMode(buttonPin, INPUT); } void loop() { buttonState=digitalRead(buttonPin); if (buttonState == HIGH) { DigiKeyboard.sendKeyStroke(KEY_L, MOD_GUI_LEFT); } }

ncat chat server

Basic chat server / client with netcat Install netcat pkg install nmap On server start daemon ncat –ssl –chat -l port & On client run ncat –ssl address port ### Broker server ncat -k -l -p xxx –broker ### Netcat client script echo “HELLO” | nc ip port -q 1

Base64 spring

Encoding file to base64 @RequestParam(“file”) MultipartFile file … if (!file.isEmpty()) { String base64 = Base64.getEncoder().encodeToString(file.getBytes()); } Decoding base64 to file HttpServletResponse response … response.addHeader(“Content-disposition”, “inline”); response.setContentType(“audio/mpeg”); Attachment attachment = attachmentRepository.findOne(id); byte[] decodedBytes = Base64.getDecoder().decode(attachment.getBase64()); OutputStream output = response.getOutputStream(); output.write(decodedBytes); output.close();

Secure spring boot with letsencrypt ssl certificate

Install the Certbot client pkg install py27-certbot Generate certificate certbot certonly –webroot -w /usr/local/www/example -d example.xyz or wildcard certificate certbot certonly –server https://acme-v02.api.letsencrypt.org/directory –manual –preferred-challenges dns -d ‘example.xyz’ -d ‘*.example.xyz’ I’m using spring on http and nginx as proxy server for ssl layer. Here is the nginx config: server { listen 443; server_name example.com; sslContinue reading “Secure spring boot with letsencrypt ssl certificate”