Skip to content

Instantly share code, notes, and snippets.

@jtbonhomme
jtbonhomme / secret.sh
Last active March 21, 2018 09:19
Generate 32 bytes long random secret
#!/bin/sh
head -c 32 /dev/urandom | openssl enc | xxd -p -c 32
@jtbonhomme
jtbonhomme / passwd.sh
Created March 20, 2018 16:52
Hash password with openssl
#!/bin/sh
openssl passwd -1 -salt sXiKzkud password
@jtbonhomme
jtbonhomme / hmac.sh
Last active March 21, 2018 14:27
Compute HMAC with sha256
#!/bin/sh
echo -n "message to sign" | openssl dgst -sha256 -hmac "`cat key.bin`" -binary | base64
@jtbonhomme
jtbonhomme / openssl_commands.md
Created April 5, 2018 09:36 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@jtbonhomme
jtbonhomme / smtp.md
Created April 25, 2018 09:36
Telnet SMTP test

Utilisation de telnet sur le port SMTP par défaut 25.

telnet smtp.mondomaine.com 25

Si tout se passe bien on obtient la connexion de la façon suivante :

Trying 87.106.143.187...
Connected to smtp.mondomaine.com.
@jtbonhomme
jtbonhomme / multiline.md
Created April 25, 2018 11:41
Pass multi line to a file
$ cat <<EOF > print.sh
#!/bin/bash
echo \$PWD
echo $PWD
EOF
@jtbonhomme
jtbonhomme / hasMany.go
Created May 22, 2018 11:11
Gorm example of foreign key definition for a hasMany relation
package main
import (
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
)
// Customer ...
type Customer struct {
@jtbonhomme
jtbonhomme / deployment_to_gitlab_pages.md
Created October 14, 2018 18:03 — forked from shyiko/deployment_to_gitlab_pages.md
Deploying to GitLab Pages (on each push)

(assuming project is hosted on GitLab)

  1. Enable shared runners by going to "Settings" > "Runners".
  2. Add .gitlab-ci.yml with the following content:
image: node:6.9.1
pages: 
  artifacts: 
paths: 
@jtbonhomme
jtbonhomme / git-origins.md
Created October 29, 2018 10:55 — forked from benschw/git-origins.md
fork a repo manually (set source as upstream origin) rather than with the "fork" button. e.g. for in github when you want to fork a project twice.

Ripped off from adrianshort.org

List curent remotes

$ git remote -v

origin  https://github.com/hakimel/reveal.js.git (fetch)
origin  https://github.com/hakimel/reveal.js.git (push)

Rename origin to upstream and add our new empty repo as the origin.

Awless template to start/stop a list of instances