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
# Count total EBS based storage in AWS | |
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add" | |
# Count total EBS storage with a tag filter | |
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add" | |
# Describe instances concisely | |
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]' | |
# Wait until $instance_id is running and then immediately stop it again | |
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id | |
# Get 10th instance in the account |
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
AWSTemplateFormatVersion: "2010-09-09" | |
Description: > | |
Create an S3 bucket and configure it for s3-website hosting | |
Create a record in a pre-existing Route53 HostedZone and point at the newly created bucket | |
Parameters: | |
HostedZoneID: | |
Description: The Hosted Zone ID in which to create the website DNS record | |
Type: AWS::Route53::HostedZone::Id | |
WebsiteAddress: | |
Description: > |
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
AWSTemplateFormatVersion: "2010-09-09" | |
Description: > | |
Launch a static website backed by an S3 bucket and served via https through cloudfront. | |
Assumes you have the following available already | |
* An address in mind (e.g. blog.example.com) | |
* An existing Route53 Hosted Zone for the domain | |
* A validated AWS ACM certificate arn for the desired web address which must be in eu-west-1 | |
Parameters: | |
HostedZoneID: | |
Description: > |
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
- name: Download files | |
get_url: | |
url: "{{item.url}}" | |
dest: "/var/www/html/{{item.dest}}" | |
with_items: [{"url": "https://archive.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz", "dest": "server1.tar.gz"}, | |
{"url": "https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.1-bin.zip", "dest": "server2.zip"}] |
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
// Credit David Walsh (https://davidwalsh.name/javascript-debounce-function) | |
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
function debounce(func, wait, immediate) { | |
var timeout; | |
var called = false; | |
// This is the function that is actually executed when |
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
console.log('%cAn error occured', 'background: red; color: white; padding: 4px; border-radius: 4px;font-weight: bold;') | |
console.log("%cStr1" + "%cStr2", "Css-for-str1", "Css-for-str2") |
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
/* | |
* to.matched is array for all the route it matches, use m.meta to get flags | |
* remember to use next() at the end ! | |
* next({name: 'new-route'}) to redirect | |
*/ | |
router.beforeEach(async (to, from, next) => { | |
if (to.matched.some(m => m.meta.needProject)) { | |
const result = await apolloClient.query({ | |
query: PROJECT_CURRENT, |
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
//https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-ui/src/util/bus.js | |
import Vue from 'vue' | |
const bus = new Vue() | |
export default { | |
install (Vue) { | |
Vue.prototype.$bus = (type, ...args) => { | |
bus.$emit(type, ...args) | |
} |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"io/ioutil" | |
"net/url" | |
"github.com/benburkert/http" | |
//"net/http" |
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
""" | |
requests.structures | |
~~~~~~~~~~~~~~~~~~~ | |
Data structures that power Requests. | |
""" | |
from .compat import OrderedDict, Mapping, MutableMapping | |
class CaseInsensitiveDict(MutableMapping): |