Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
| #!/bin/bash | |
| ## config | |
| backupFoldersList=" | |
| /home/user/projects/project-name | |
| " | |
| backupDstFolder="/home/user/projects-dump" | |
| ## /config | |
| targetFolder="dump-$(date +%Y-%m-%d_%H%M%S)" |
| #!/bin/bash | |
| # Optional variables for a backup script | |
| MYSQL_USER="root" | |
| MYSQL_PASS="secret" | |
| BACKUP_DIR=./$(date +%Y-%m-%d_%H%M%S); | |
| test -d "$BACKUP_DIR" || mkdir -p "$BACKUP_DIR" | |
| # Get the database list | |
| for db in $(mysql -B -s -u $MYSQL_USER --password=$MYSQL_PASS -e 'show databases') |
| axios({ | |
| url: 'http://localhost:5000/static/example.pdf', | |
| method: 'GET', | |
| responseType: 'blob', // important | |
| }).then((response) => { | |
| const url = window.URL.createObjectURL(new Blob([response.data])); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.setAttribute('download', 'file.pdf'); | |
| document.body.appendChild(link); |
| Here's how to make jQuery DataTables work with npm and webpack. This is the simplest way I found to do it. | |
| See the previous revision of this gist for a way to do it with forcing AMD to be disabled if you need that. | |
| Install DT core: npm install datatables.net | |
| Install a DT style: npm install datatables.net-dt | |
| Then to initialize DT in your app, do this in your main entry point: | |
| // you can use import or require | |
| import dt from 'datatables.net'; |
| package main | |
| import ( | |
| "bufio" | |
| "crypto/aes" | |
| "crypto/cipher" | |
| "crypto/rand" | |
| "fmt" | |
| "io" | |
| "io/ioutil" |
| error_page 400 404 405 =200 @40*_json; | |
| location @40*_json { | |
| default_type application/json; | |
| return 200 '{"code":"1", "message": "Not Found"}'; | |
| } | |
| error_page 500 502 503 504 =200 @50*_json; | |
| location @50*_json { |
The process starts by creating the CSR and the private key:
openssl req -nodes -newkey rsa:2048 -nodes -keyout dotmarks.net.key -out dotmarks.net.csr -subj "/C=GB/ST=London/L=London/O=dotmarks/OU=IT/CN=dotmarks.net"
Generates
| package main | |
| /* | |
| URL: https://github.com/mccoyst/myip/blob/master/myip.go | |
| URL: http://changsijay.com/2013/07/28/golang-get-ip-address/ | |
| */ | |
| import ( | |
| "net" | |
| "os" |
| //needs import ("time") | |
| m.Use(render.Renderer(render.Options{ | |
| Directory: "templates", | |
| Layout: "layout", | |
| Funcs: []template.FuncMap{ | |
| { | |
| "formatTime": func(args ...interface{}) string { | |
| t1 := time.Unix(args[0].(int64), 0) | |
| return t1.Format(time.Stamp) | |
| }, |