Skip to content

Instantly share code, notes, and snippets.

View ridhwaans's full-sized avatar
🎯
Focusing

ridhwaans ridhwaans

🎯
Focusing
View GitHub Profile
@ridhwaans
ridhwaans / read_file_list.js
Last active July 25, 2021 14:50
file list to array
// get line separated list without whitespace, newline, carriage return characters
const fs = require('fs');
const path = require('path');
const DIR_PATH = path.resolve(__dirname,'../subdirectory')
const list = fs.readFileSync(`${DIR_PATH}/list_to_read.txt`, "utf-8").split("\n").map(i => i.replace(/(\r\n|\n|\r)/gm, ""))
@ridhwaans
ridhwaans / useful-queries.sql
Last active June 3, 2020 19:56
useful-queries
-- list tables by size
select schemaname as table_schema,
relname as table_name,
pg_size_pretty(pg_total_relation_size(relid)) as total_size,
pg_size_pretty(pg_relation_size(relid)) as data_size,
pg_size_pretty(pg_total_relation_size(relid) - pg_relation_size(relid))
as external_size
from pg_catalog.pg_statio_user_tables
order by pg_total_relation_size(relid) desc,
pg_relation_size(relid) desc
@ridhwaans
ridhwaans / terminal-notes
Last active April 13, 2023 18:36
terminal-notes
# cheat_sheet.org.sh
# The contents of this file are released under the GNU General Public License. Feel free to reuse the contents of this work, as long as the resultant works give proper attribution and are made publicly available under the GNU General Public License.
# Best viewed in emacs org-mode.
# Alternately, one can keep this cheat sheet handy by adding the following line to ~/.bashrc:
#
# alias cheatsheet="less ~/path_to_cheat_sheet.org.sh"
* Reference:
** Basics:
@ridhwaans
ridhwaans / webpack.config.js
Last active April 1, 2019 16:01
webpack config
const path = require('path');
const PATHS = {
src: path.join(__dirname, './src'),
public: path.join(__dirname, './public')
};
var config = {
entry: {
app: [ 'babel-polyfill', path.resolve(PATHS.src, 'index.js') ]