Local Mongo replication
Find mongod.conf
mongosh
db.serverCmdLineOpts()| import { fromPairs, is, map, pipe, toPairs } from 'ramda' | |
| const isObject = is(Object) | |
| const transformKey = transform => | |
| ([k, v]) => !isObject(v) ? [transform(k), v] : | |
| [transform(k), mapKeys(transform)(v)] | |
| const mapKeys = transform => | |
| pipe( |
| const monthLabels = Array(12) | |
| .fill() | |
| .map((_, i) => new Date(`${i+1}`).toDateString()) | |
| .map(date => date.slice(4, 7)) | |
| export default monthLabels | |
| // ['Jan', 'Feb', 'Mar', ...'Dec'] |
| autoload -Uz vcs_info | |
| precmd() { vcs_info } | |
| zstyle ':vcs_info:git:*' formats '- %b' | |
| zstyle ':vcs_info:*' check-for-changes true | |
| setopt PROMPT_SUBST | |
| PROMPT='${PWD/#$HOME/~} %F{white}%B${vcs_info_msg_0_}%b%f | |
| %# ' |
| SELECT CURRENT_TIMESTAMP; | |
| +---------------------+ | |
| | current_timestamp | | |
| +---------------------+ | |
| | 2023-07-23 13:28:42 | | |
| +---------------------+ | |
| # subtract 10 minutes from current timestamp | |
| SELECT DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 MINUTE); |
| CREATE TABLE things ( | |
| id int NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| created timestamp NULL DEFAULT CURRENT_TIMESTAMP, | |
| str varchar(10), | |
| expires timestamp | |
| ); | |
| INSERT INTO things (str) VALUES ('one'); | |
| CREATE TRIGGER set_thing_expires |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>SVG with border radius</title> | |
| </head> | |
| <body> | |
| <svg width="400" height="400" viewBox="0 0 400 400"> | |
| <defs> |
Local Mongo replication
Find mongod.conf
mongosh
db.serverCmdLineOpts()| #!/bin/bash | |
| if [ -z "$1" ]; then | |
| echo "Usage: $0 path_to_folder" | |
| exit 1 | |
| fi | |
| TARGET_DIR="$1" | |
| find "$TARGET_DIR" -type f \( -name "*.ts" -o -name "*.tsx" \) | while read -r file; do |