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
const fs = require('mz/fs'); | |
const read = async() => { | |
const root = '/Users/testing-s3-2/' | |
let html = `<html><table style="width:100%" border="1">` | |
const folders = await fs.readdir(root); | |
for (const folder of folders) { | |
if (!fs.lstatSync(folder).isDirectory()) continue; | |
if (folder.startsWith('.') || folder.startsWith('node_modules')) continue; | |
html += '<tr>' |
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
brew doctor | |
brew update | |
brew services list | |
brew services stop postgres | |
brew uninstall postgres | |
rm -rf /usr/local/var/postgres | |
rm -rf /usr/local/opt/postgresql | |
rm -rf .psql_history .psqlrc .psql.local .pgpass .psqlrc.local | |
# then use docker to start local postgres to avoid all these issues with running postgres on your local |
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
-- find biggest database | |
SELECT *, pg_size_pretty(total_bytes) AS total | |
, pg_size_pretty(index_bytes) AS INDEX | |
, pg_size_pretty(toast_bytes) AS toast | |
, pg_size_pretty(table_bytes) AS TABLE | |
FROM ( | |
SELECT *, total_bytes-index_bytes-COALESCE(toast_bytes,0) AS table_bytes FROM ( | |
SELECT c.oid,nspname AS table_schema, relname AS TABLE_NAME | |
, c.reltuples AS row_estimate | |
, pg_total_relation_size(c.oid) AS total_bytes |
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
const data1 = { | |
attributes: { | |
domain: 'from.attributes.com' | |
} | |
} | |
const data2 = { | |
attributes: { | |
unknownAttributes: { | |
domain: 'from.unknownAttributes.com' |
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
const data1 = { | |
attributes: { | |
domain: 'from.attributes.com' | |
} | |
} | |
const data2 = { | |
attributes: { | |
unknownAttributes: { | |
domain: 'from.unknownAttributes.com' |
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
const data1 = { | |
attributes: { | |
domain: 'from.attributes.com' | |
} | |
} | |
const data2 = { | |
attributes: { | |
unknownAttributes: { | |
domain: 'from.unknownAttributes.com' |
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
# List existing mongo process | |
pgrep mongo | |
# Kill existing process if has. | |
pkill mongo | |
# Clear old folder if has. | |
rm -rf rs0 && rm -rf rs1 && rm -rf rs2 | |
# Create log folder. | |
mkdir -p ./var/log/mongodb | |
# Create replica set 0 | |
. rs.sh 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
#!/bin/bash | |
RS_INDEX=$1 | |
RS_NAME="rs"$1 | |
mkdir $RS_NAME | |
PORT=$((27017+$RS_INDEX)) | |
cat <<EOF > $RS_NAME.conf | |
systemLog: | |
destination: file | |
path: "var/log/mongodb/mongod.log" | |
logAppend: true |
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
const SomeService = require('some/service') | |
const AWS = require('aws-sdk') | |
describe('someService', async function() { | |
let someService | |
beforeEach(async function() { | |
someService = new SomeService() | |
}) |
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
resource "aws_autoscaling_policy" "myservice-asg-policy" { | |
name = "myservice-asg-policy" | |
policy_type = "TargetTrackingScaling" | |
target_tracking_configuration { | |
predefined_metric_specification { | |
predefined_metric_type = "ASGAverageNetworkOut" | |
} | |
target_value = 800000000 | |
} | |
autoscaling_group_name = "${module.myservice.asg_name}" |