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 | |
# ------------------------------------------------------------------ | |
# This script deploys the application to production | |
# | |
# example: | |
# | |
# scripts/deploy | |
# ------------------------------------------------------------------ |
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 | |
echo -e '\n\nSample test body' | LC_ALL=C mail -Sv15-compat -Sttycharset=utf8 \ | |
-S 'mta=smtp://smtpuser:smtppassword@smtphost:587' -S 'smtp-auth=plain' \ | |
-a 'attachment.bin' \ | |
-r '[email protected]' \ | |
-s 'sample subject' \ | |
-t '[email protected]' |
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 fastGlob from 'fast-glob'; | |
import crypto from 'crypto'; | |
import path from 'path'; | |
import fs from 'fs'; | |
// I could try to parse the HTML files using cheerio[1], but a simple find and replace | |
// is likely to be faster, more powerful and - realistically - quite as much as reliable. | |
// | |
// [1] just like this: https://github.com/maxogden/inline-images/blob/master/index.js |
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 hostnameIsPrivate from "hostname-is-private"; | |
import { promisify } from "util"; | |
const isSafeUrl = async (untrustedUrl, protocols = ["http", "https"]) => { | |
try { | |
// will throw error on malfomed url | |
const url = new URL(untrustedUrl); | |
// no protocol, no fun | |
if (!url.protocol) return false; |
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
fragment FullType on __Type { | |
kind | |
name | |
fields(includeDeprecated: true) { | |
name | |
args { | |
...InputValue | |
} | |
type { | |
...TypeRef |
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 | |
# will wait | |
flock -n /tmp/mycommand.flock mycommand | |
# -n makes it fail rather than wait | |
flock -n /tmp/mycommand.flock mycommand |
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 | |
ignore () { true } | |
warning () { echo "$@" } | |
error () { ERR=$?; echo "$@"; return $ERR } | |
# --- Usage | |
# | |
# set -e; | |
# |
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 | |
xmodmap -e "keycode 66 = Mode_switch" | |
xmodmap -e "keysym i = i I Up" | |
xmodmap -e "keysym j = j J Left" | |
xmodmap -e "keysym k = k K Down" | |
xmodmap -e "keysym l = l L Right" | |
xmodmap -e "keysym u = u U Prior" | |
xmodmap -e "keysym o = o O Next" |
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 | |
echo "Waiting for port opening on ${1}:${2}..." | |
function check_port() { | |
local host=${1} && shift | |
local port=${1} && shift | |
local retries=90 | |
local wait=1 |
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
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Check for maintenance | |
|-------------------------------------------------------------------------- | |
| | |
| Se l'applicazione è standby proviamo ad aspettare che torni su. In questo | |
| modo l'utente non riceve messaggi di errore durante il deploy, non perde | |
| i dati inviati nel form, etc. |
NewerOlder