This file contains 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
/*! | |
* Destroy all open connections so a server can close. | |
* Inspired by https://github.com/marten-de-vries/killable | |
*/ | |
import http from 'http'; | |
import { Socket } from 'net'; | |
// Set of open sockets | |
const sockets: Set<Socket> = new Set(); |
This file contains 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
/** | |
* @template {(...args: any[]) => Promise<any>} T | |
* @param {T} fn | |
* @returns {(...args: Parameters<T>) => Promise<ReturnType<T>|void>} | |
*/ | |
export const wrap = (fn) => (...args) => fn(...args).catch(args[2]); |
This file contains 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
import { BaseMemoryStore, Store } from 'express-session'; | |
export class MemoryStore extends Store implements BaseMemoryStore { | |
/** | |
* A key/value mapping of session IDs to serialized (stringified) sessions. | |
*/ | |
private readonly sessions: Map<string, string>; | |
public constructor() { | |
super(); |
This file contains 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
version: "3.5" | |
services: | |
mongo: | |
image: mongo:latest | |
container_name: mongo | |
environment: | |
MONGO_INITDB_ROOT_USERNAME: admin | |
MONGO_INITDB_ROOT_PASSWORD: admin | |
ports: |
This file contains 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
SELECT tables.table_schema, tables.table_name | |
FROM tables | |
LEFT JOIN key_column_usage AS kcu ON ( | |
kcu.table_name = tables.table_name AND | |
kcu.constraint_schema = tables.table_schema AND | |
kcu.constraint_name = 'PRIMARY') | |
WHERE tables.table_schema = @db_name AND | |
kcu.constraint_name IS NULL; |
This file contains 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
$grid-columns: 12; | |
$grid-gutter-width: 30px; | |
$grid-breakpoints: ( | |
xs: 0, | |
sm: 768px, | |
md: 992px, | |
lg: 1200px, | |
); | |
$screen-sm-min: map-get($grid-breakpoints, "sm"); |
This file contains 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 | |
set -e | |
if [ "$(id -u)" != '0' ]; then | |
SUDO=sudo | |
fi | |
policies=( | |
'INPUT' |
This file contains 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 | |
set -e | |
# Running `modprobe br_netfilter` does not persist. | |
echo 'br_netfilter' >> /etc/modules | |
# Running `sysctl net.bridge.bridge-nf-call-iptables=1` does not persist. | |
echo 'net.bridge.bridge-nf-call-iptables=1' >> /etc/sysctl.conf | |
echo 'net.bridge.bridge-nf-call-ip6tables=1' >> /etc/sysctl.conf |
This file contains 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 | |
set -e | |
docker run \ | |
-it \ | |
-v /var/lib/docker:/var/lib/docker \ | |
-w /var/lib/docker \ | |
--rm \ | |
--name=debian \ |
This file contains 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
#!/usr/bin/env node | |
/** | |
* Grafana Dashboard Screenshot | |
* | |
* Derived from https://github.com/sindresorhus/capture-website/blob/v0.8.0/index.js | |
* by @sindresorhus (MIT). | |
*/ | |
const fs = require('fs'); |
OlderNewer