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 | |
bucket=redirect.example.com | |
target_url=https://www.example.com | |
create_redirect(){ | |
aws s3api put-object \ | |
--acl public-read \ | |
--bucket "$bucket" \ | |
--website-redirect-location "$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
location @custom-404 { | |
types { } | |
default_type text/html; | |
return 404 "404 Not Found"; | |
} | |
location @reverse-proxy-fallback { | |
recursive_error_pages on; | |
proxy_intercept_errors on; | |
error_page 404 = @custom-404; |
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
ffmpeg -i http://www.example.com/movie.flv -c -copyts movie.mp4 |
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 | |
FQDN="$1" | |
[ -z "$FQDN" ] && echo "Usage: `basename $0` <fqdn>" && exit 1 | |
echo -n \ | |
| openssl s_client -connect "${FQDN}:443" \ | |
| sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \ | |
| openssl x509 -text -noout |
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
sed -i.bak '/REGEXP/d' * |
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
/** | |
* Pick given number of random items from array | |
* @param {Array} array | |
* @param {Number} [count=1] | |
* @return {(*|Array)} random item or array of random items if count > 1 | |
*/ | |
function getRandomArrayItems(array, count) { | |
var | |
length = array.length, | |
randomIndexes = [], |
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
/** | |
* Save file splitting it by chunks of 9M | |
* @param {Blob} FileBlob blob data to save | |
* @param {Folder} folder destination folder | |
* @param {Number} chunkSize | |
* @return {String} | |
*/ | |
function saveFileByChunks(fileBlob, folder, chunkSize) { | |
var | |
fileName = new Date().getTime(), |
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
<div class="row"> <div class="large-12 column"> <p>Chunk Size: 1mb (1048576 bytes)</p> <input type="number" min="1048576" value="1048576" id="numChunks" /> <input type="file" id="afile" /> <div id="done"></div> <div id="bars"></div> </div> </div> |
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 | |
# Merge splitted files in current folder | |
files=$(ls | grep \\-chunk- | sed s/-chunk-.\*$// | uniq) | |
for file in $files; do | |
cat $file-chunk-* > $file && rm -f $file-chunk-* | |
done |
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
#cloud-config | |
coreos: | |
units: | |
- name: systemd-sysctl.service | |
command: restart | |
- name: create-swap.service | |
command: start | |
runtime: true | |
content: | |