Skip to content

Instantly share code, notes, and snippets.

@matt-long-92
matt-long-92 / tmux-cheat-sheet.md
Created September 28, 2022 20:42 — forked from michaellihs/tmux-cheat-sheet.md
tmux Cheat Sheet
@matt-long-92
matt-long-92 / list.txt
Created August 2, 2022 11:27 — forked from shortjared/list.txt
List of AWS Service Principals
a4b.amazonaws.com
access-analyzer.amazonaws.com
account.amazonaws.com
acm-pca.amazonaws.com
acm.amazonaws.com
airflow-env.amazonaws.com
airflow.amazonaws.com
alexa-appkit.amazon.com
alexa-connectedhome.amazon.com
amazonmq.amazonaws.com
const http = require("http");
const server = http.createServer();
const PORT = 80;
server
.on("request", (request, response) => {
let body = [];
request
.on("data", (chunk) => {
body.push(chunk);
@matt-long-92
matt-long-92 / postgres-cheatsheet.md
Created December 1, 2021 15:00 — forked from Kartones/postgres-cheatsheet.md
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)
const { readFile } = require('fs')
readFile(__filename, () => {
new Promise(function (resolve, reject) {
console.log('new promise')
resolve()
}).then(() => {
console.log('then 1')
})
new Promise(function (resolve, reject) {
console.log('new promise')
resolve()
}).then(() => {
console.log('then 1')
})
async function foo () {
console.log('async function')
const fs = require("fs");
fs.readFile(__filename, () => {
// Adding a callback to the timers FIFO queue with setTimeout
setTimeout(() => {
console.log("a");
});
// Adding a callback to the immediate FIFO queue with setImmediate
setImmediate(() => {
// Adding a callback to the timers FIFO queue with setTimeout
setTimeout(() => {
console.log("a");
});
// Adding a callback to the immediate FIFO queue with setImmediate
setImmediate(() => {
console.log("b");
});
// Calling .then on a resolved Promise
new Promise((resolve, reject) => {
resolve("a");
}).then((value) => {
console.log(value);
});
// Calling .catch on a rejected Promise
new Promise((resolve, reject) => {
reject(new Error("a"));
package main
import (
"fmt"
"os"
"runtime"
"sync"
"time"
)