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
type Callback<T> = () => Promise<T> | |
export type AsyncQueue<T = void> = { | |
push: (task: Callback<T>) => Promise<T> | |
flush: () => Promise<void> | |
size: number | |
} | |
/** | |
* Ensures that each callback pushed onto the queue is executed in series. |
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
#### | |
# ZSH function to auto-switch to correct Node version | |
# https://gist.github.com/callumlocke/30990e247e52ab6ac1aa98e5f0e5bbf5 | |
# | |
# - Searches up your directory tree for the closest .nvmrc, just like `nvm use` does. | |
# | |
# - If you are already on the right Node version, IT DOES NOTHING, AND PRINTS NOTHING. | |
# | |
# - Works correctly if your .nvmrc file contains something relaxed/generic, | |
# like "4" or "v12.0" or "stable". |
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 { Connection, ConnectionManager, ConnectionOptions, createConnection, getConnectionManager } from 'typeorm' | |
import { inspect } from 'util' | |
import { SnakeNamingStrategy } from './SnakeNamingStrategy' | |
import 'envkey' | |
/** | |
* Database manager class | |
*/ | |
export class Database { | |
private connectionManager: ConnectionManager |
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 { Connection, ConnectionManager, ConnectionOptions, createConnection, getConnectionManager } from 'typeorm' | |
import { inspect } from 'util' | |
import { SnakeNamingStrategy } from './SnakeNamingStrategy' | |
import 'envkey' | |
/** | |
* Database manager class | |
*/ | |
export class Database { | |
private connectionManager: ConnectionManager |
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 * as lambda from 'aws-lambda' | |
import connectionOptions from '../db/ConnectionOptions' | |
import { Connection } from 'typeorm' | |
import { Database } from '../db' | |
import { User } from '../entities' | |
import 'reflect-metadata' | |
import 'envkey' | |
exports.api = async (event: lambda.APIGatewayProxyEvent, serverlessContext: lambda.Context) => { | |
// This enables Lambda function to complete |
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 "reflect-metadata"; | |
import { APIGatewayEvent, Context } from "aws-lambda"; | |
import { BaseEntity, Column, Connection, Entity, getConnectionManager, PrimaryColumn } from "typeorm"; | |
import v4 = require("uuid/v4"); | |
@Entity() | |
export class TData extends BaseEntity { | |
@PrimaryColumn() | |
public id: string; |
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 | |
hdiutil create -o /tmp/Mojave.cdr -size 8g -layout SPUD -fs HFS+J | |
hdiutil attach /tmp/Mojave.cdr.dmg -noverify -mountpoint /Volumes/install_build | |
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build | |
mv /tmp/Mojave.cdr.dmg ~/Desktop/InstallSystem.dmg | |
hdiutil detach /Volumes/Install\ macOS\ Mojave | |
hdiutil convert ~/Desktop/InstallSystem.dmg -format UDTO -o ~/Desktop/Mojave.iso | |
mv ~/Desktop/Mojave.iso.cdr ~/Desktop/Mojave.iso |
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 bash | |
# vim: ai ts=2 sw=2 et sts=2 ft=sh | |
# Use this script to install or re-install | |
# multiple versions of PHP on MacOS. | |
# | |
# Usage: | |
# curl -L https://git.io/v52yY | bash | |
# Check OS. |
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
# | |
# Auth filter /etc/fail2ban/filter.d/nginx-auth.conf: | |
# | |
# Blocks IPs that makes too much accesses to the server | |
# | |
[Definition] | |
failregex = ^<HOST> -.*"(GET|POST).*HTTP.*" | |
ignoreregex = |