This file contains hidden or 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
# snagged from https://stackoverflow.com/a/30988704 | |
# Use the mapfile command: | |
mapfile -t myArray < file.txt | |
# The error is using for -- the idiomatic way to loop over lines of a file is: | |
while IFS= read -r line; do echo ">>$line<<"; done < file.txt |
This file contains hidden or 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 | |
OF=/var/my-backup-$(date +%Y%m%d).tgz | |
tar -cZf $OF /home/me/ |
This file contains hidden or 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
# plucked from https://stackoverflow.com/a/25180186 | |
#!/bin/bash | |
# Read a string with spaces using for loop | |
for value in I like programming | |
do | |
echo $value | |
done |
This file contains hidden or 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
# plucked from https://stackoverflow.com/a/25180186 | |
#!/bin/bash | |
function try() | |
{ | |
[[ $- = *e* ]]; SAVED_OPT_E=$? | |
set +e | |
} |
This file contains hidden or 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
# Use the hash sign to prefix a comment | |
# +---------------- minute (0 - 59) | |
# | +------------- hour (0 - 23) | |
# | | +---------- day of month (1 - 31) | |
# | | | +------- month (1 - 12) | |
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7) | |
# | | | | | | |
# * * * * * command to be executed | |
#-------------------------------------------------------------------------- | |
This file contains hidden or 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
{ | |
"Id": "XXX", | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "XXX", | |
"Action": [ | |
"s3:GetObject" | |
], | |
"Effect": "Allow", |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<CORSConfiguration xmlns="https://s3.amazonaws.com/doc/2006-03-01"> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<AllowedMethod>PUT</AllowedMethod> | |
<AllowedMethod>POST</AllowedMethod> | |
<AllowedMethod>DELETE</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>*</AllowedHeader> |
This file contains hidden or 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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Cognito Stack | |
Parameters: | |
AuthName: | |
Type: String | |
Description: Unique Auth Name for Cognito Resources | |
Resources: | |
# Creates a role that allows Cognito to send SNS messages | |
SNSRole: |
This file contains hidden or 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
<CORSConfiguration> | |
<CORSRule> | |
<AllowedOrigin>*</AllowedOrigin> | |
<AllowedMethod>GET</AllowedMethod> | |
<MaxAgeSeconds>3000</MaxAgeSeconds> | |
<AllowedHeader>Authorization</AllowedHeader> | |
</CORSRule> | |
</CORSConfiguration> |
This file contains hidden or 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
IF EXISTS (SELECT * | |
FROM sys.foreign_keys | |
WHERE object_id = OBJECT_ID(N'dbo.FK_TableName_TableName2') | |
AND parent_object_id = OBJECT_ID(N'dbo.TableName') | |
) | |
ALTER TABLE [dbo.TableName] DROP CONSTRAINT [FK_TableName_TableName2] |