Skip to content

Instantly share code, notes, and snippets.

@mercuriete
mercuriete / memory.js
Created April 26, 2023 11:07
determine what memory limits you have on nodejs
# copied from https://stackoverflow.com/questions/73600496/heroku-node-js-app-allocation-failure-scavenge-might-not-succeed-with-memory-s
const v8 = require('v8');
// added the code below to a route that caused a memory leak
const heapStats = v8.getHeapStatistics();
const heapStatsMB = heapStats;
for (const key in heapStatsMB) {
heapStatsMB[key] = `${(((heapStatsMB[key] / 1024 / 1024) * 100) / 100).toFixed(2)} MB`;
}
console.table(heapStatsMB);
#!/bin/bash
aws rds create-db-snapshot --db-instance-identifier db --db-snapshot-identifier snapshot
aws rds wait db-snapshot-completed --db-snapshot-identifier snapshot
aws rds delete-db-snapshot --db-snapshot-identifier snapshot
@mercuriete
mercuriete / rm_rm_node_modules.sh
Created November 26, 2021 11:34
delete all node_modules
#!/bin/bash
# Please give all credit to this stackoverflow post
# https://stackoverflow.com/questions/42950501/delete-node-modules-folder-recursively-from-a-specified-path-using-command-line
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
#!/bin/bash
cat file | jq -sR .
.renovate-template:
variables:
RENOVATE_GIT_AUTHOR: "${GITLAB_USER_NAME} <${GITLAB_USER_EMAIL}>"
RENOVATE_DRY_RUN: "false"
RENOVATE_LOG_LEVEL: "info"
image:
name: node:12
entrypoint: [""]
only:
- schedules
#!/bin/bash
# NON Distributed Denial of Service xD LOL
while true; do
for i in {1..1000}
do
curl -X GET "https://www.google.es" &
#echo "$i"
general {
output_format = "i3bar"
colors = true
interval = 5
}
order += "disk /"
disk "/" {
format = "%free"
}
#!/bin/bash
# sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean
apt-get update
apt-get dist-upgrade
apt-get autoremove
apt-get autoclean
apt-get clean
#!/bin/bash
# Originally written by Ralf Kistner <[email protected]>, but placed in the public domain
set +e
bootanim=""
failcounter=0
timeout_in_sec=360
#!/bin/bash
# Please give credit to: https://gist.github.com/matthewmccullough/988077
# and to: https://gist.github.com/matthewmccullough/988077#gistcomment-2928496
# Go there and give a star there and not here.
# This is only a copy and paste for personal purposes
gitk --all $(git reflog --format=format:%h)