Skip to content

Instantly share code, notes, and snippets.

View alphakevin's full-sized avatar
🌏
working remotely on a bus

Yi Ma alphakevin

🌏
working remotely on a bus
View GitHub Profile
@hfossli
hfossli / standard.sh
Last active February 8, 2024 05:19
Standard bash script format
#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"
@toboid
toboid / promisify-multiple-args.js
Created June 18, 2017 15:20
util.promisify where callback takes multiple arguments
const {promisify} = require('util');
const child = require('child_process');
const exec = promisify(child.exec);
exec('echo "Hello world"').then(
result => console.log(result), // Prints { stdout: 'Hello world\n', stderr: '' }
error => console.error(error)
);
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 27, 2024 08:12
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active April 2, 2024 20:18
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version