This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
prom.id, p.id, p.direccion, p.latitud, p.longitud, | |
( | |
6371 * | |
ACOS( | |
COS( RADIANS( 6.250020 ) ) * | |
COS( RADIANS( `latitud` ) ) * | |
COS( | |
RADIANS( `longitud` ) - RADIANS( -75.568510 ) | |
) + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sending to sender-client only | |
socket.emit('message', "this is a test"); | |
// sending to all clients, include sender | |
io.emit('message', "this is a test"); | |
// sending to all clients except sender | |
socket.broadcast.emit('message', "this is a test"); | |
// sending to all clients in 'game' room(channel) except sender |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias babel-node='babel-node --presets stage-0' | |
------ RECV ------ | |
// babel-node recv2.js "#" | |
// babel-node recv2.js "kern.*" | |
const amqp = require('amqplib'); | |
const args = process.argv.slice(2); | |
if (args.length == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -it --rm --name letsencrypt \ | |
-v /letsencrypt/etc/letsencrypt:/etc/letsencrypt \ | |
-v /letsencrypt/var/lib/letsencrypt:/var/lib/letsencrypt \ | |
quay.io/letsencrypt/letsencrypt:latest \ | |
certonly \ | |
-d domain.com \ | |
-d *.domain.com \ | |
--manual \ | |
--preferred-challenges dns \ | |
--server https://acme-v02.api.letsencrypt.org/directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring: | |
datasource: | |
type: com.zaxxer.hikari.HikariDataSource | |
url: jdbc:postgresql://host:5432/database | |
username: 123 | |
password: 123 | |
hikari: | |
minimum-idle: 9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# error from daemon in stream: Error grabbing logs: rpc error: code = Unknown desc = warning: incomplete log stream. some logs could not be retrieved for the following reasons: node xxx is not available | |
docker swarm ca --rotate | |
# list docker swarm nodes with labels | |
docker node ls -q | xargs docker node inspect \ | |
-f '{{ .ID }} [{{ .Description.Hostname }}]: {{ .Spec.Labels }}' | |
# list docker swarm nodes with IPs | |
for NODE in $(docker node ls --format '{{.Hostname}}'); \ | |
do echo -e "${NODE} - $(docker node inspect --format '{{.Status.Addr}}' "${NODE}")"; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------------- | |
express | |
----------------------- | |
Running 10s test @ http://localhost:3000 | |
8 threads and 1024 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 47.78ms 19.09ms 212.47ms 66.94% | |
Req/Sec 1.31k 268.90 2.07k 72.38% | |
104687 requests in 10.02s, 21.47MB read | |
Socket errors: connect 0, read 877, write 0, timeout 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can already do this by connecting to your Mongo database. | |
List the rooms with db.rocketchat_room.find({}), grab the ID of the room you want the history for. | |
Then you can see that room's history with db.rocketchat_message.find({"rid": "your_chatroom_id"}, {"u.username": 1, "msg": 1, "_id": 0}).sort({ts: 1}).map(function (d) {return d.u.username + ": " + d.msg}) | |
It's not as intuitive as a web interface, but auditing your users' chat logs should seldom be done therefore this is a viable workaround in the meantime. | |
This topic attracts a great deal of controversy, as it should. That being said, this method is a workaround until there is a corresponding UI. This also means that you are already being recorded when chatting using RocketChat since your messages are saved in the database unencrypted (unless you use OTR). If you allow your users to edit/delete their messages, they are indeed modified/deleted from the database, so take that into account. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Configuration | |
CONTAINER="mongo" | |
FILENAME="databasename-`date +%Y-%m-%d`" | |
MONGO_USER='user' | |
MONGO_PASSWORD='pass' | |
DATABASE_NAME='databasename' | |
S3_BUCKET_NAME='bucket' | |
S3_BUCKET_PATH='backups/database' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Configuration | |
CONTAINER="mysql" | |
FILENAME="databasename-`date +%Y-%m-%d`.sql" | |
MYSQL_USER='user' | |
MYSQL_PASSWORD='password' | |
DATABASE_NAME='databasename' | |
S3_BUCKET_NAME='bucket' | |
S3_BUCKET_PATH='backups' |
OlderNewer