Skip to content

Instantly share code, notes, and snippets.

View wdalmut's full-sized avatar
💭
Fantasy Land

Walter Dal Mut wdalmut

💭
Fantasy Land
View GitHub Profile
@wdalmut
wdalmut / README.md
Created June 21, 2020 04:38 — forked from pcan/README.md
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.

Prepare certificates

Generate a Certificate Authority:

@wdalmut
wdalmut / ca.md
Created December 23, 2019 20:23 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@wdalmut
wdalmut / delete-slack-messages.js
Last active February 2, 2019 17:10 — forked from firatkucuk/delete-slack-messages.js
Deletes slack public/private channel and chat messages.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN'; // You can learn it from: https://api.slack.com/custom-integrations/legacy-tokens
// GLOBALS #############################################################################################################
@wdalmut
wdalmut / gist:24c2c5350fd548a786176d21c91738dc
Created October 29, 2018 14:58 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'
@wdalmut
wdalmut / model-user.js
Created May 7, 2018 12:05 — forked from lucasscariot/model-user.js
Composite Primary Key in Sequelize
/*
* Migration
*/
'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Users', {
firstName: {
type: Sequelize.STRING
},
@wdalmut
wdalmut / docker-nfs-volumes.md
Created March 20, 2018 16:13 — forked from ruanbekker/docker-nfs-volumes.md
NFS Volumes with Docker Swarm

Create NFS Volumes:

Creating the NFS Volume:

$ docker volume create --driver local \
  --opt type=nfs \
  --opt o=addr=192.168.1.115,uid=1000,gid=1000,rw \
  --opt device=:/mnt/volumes/mysql-test \
  mysql-test-1
@wdalmut
wdalmut / config.yml
Created January 24, 2018 13:47 — forked from K-Phoen/config.yml
Storing Symfony2 sessions in memcached
imports:
# ....
- { resource: services/session.yml }
framework:
# ....
session:
handler_id: session.handler.memcached
@wdalmut
wdalmut / docker advertise + overlay
Created July 11, 2017 20:00
CoreOS + Docker Swarm
sudo mkdir /etc/systemd/system/docker.service.d/
sudo vim /etc/systemd/system/docker.service.d/cluster.conf
[Service]
Environment="DOCKER_OPTS=--cluster-advertise=10.0.0.2:2375 --cluster-store=etcd://10.0.0.2:2379 --host=tcp://10.0.0.2:2375"
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker
@wdalmut
wdalmut / clone_redis.py
Created October 14, 2015 15:19 — forked from jimmyislive/clone_redis.py
Redis Elasticache Export
from optparse import OptionParser
import sys
import redis
__author__ = 'Jimmy John'
__doc__ = '''
This is a script to make a copy of a redis db. Mainly to be used for cloning AWS Elasticache
instancces. Elasticache seems to disable the SAVE/BGSAVE commands and you do not have access to
the physical redis instances. The UI allows you to create 'Snapshots', but no way to download
# lib/puppet/parser/functions/pw_hash.rb
module Puppet::Parser::Functions
newfunction(:pw_hash, type: :rvalue) do |args|
raise Puppet::ParseError, "pw_hash takes exactly two arguments, #{args.length} provided" if args.length != 2
# SHA512 ($6), default number of rounds (5000)
# rounds could be specified by prepending rounds=<n>$ parameter before the salt, i.e.
# args[0].crypt("$6$rounds=50000$#{args[1]}")
args[0].crypt("$6$#{args[1]}")
end