Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.
- Go to
settings
. - Search for
live templates
. - Under the javascript section you should be able to manage your templates.
# required: ffmpeg (e.g. from homebrew), terminal-notifier from https://github.com/alloy/terminal-notifier | |
# you can schedule this with launchd to run e.g. weekly | |
# Specify in seconds how long the script should record (default here is 1 hour). | |
seconds=3600 | |
# Date format for the recording file name | |
DATE=`date "+%d-%m-%y_%H-%M"` | |
# start ffmpeg recording |
There are a few JQL syntax bits to get you started:
AND
--- allows you to add qualifiers to a list!= Thing
--- target one thingis in (List, Of, Things)
--- target a bunch of things (Done, Closed, Resolved) typicallynot in (List, of, Things)
--- do not include a bunch of things-1w
--- relative time. You can also use -1d for day"2015/3/15"
--- specific dates{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "Keep alive functions", | |
"Resources": { | |
"LambdaPolicy": { | |
"Type": "AWS::IAM::ManagedPolicy", | |
"Properties": { | |
"PolicyDocument": { |
This is mainly for node.js but might apply to other environments. Unsure.
If you are running a AWS Lambda function that calls another AWS service and getting an error about invalid tokens or other access denied errors, do this:
The role assigned to your lambda function will need permission to perform the actions. Check IAM and make sure the role has all the permissions.
#!/bin/bash | |
branch_name=$(git symbolic-ref --short HEAD) | |
if [ "$branch_name" == 'dev' ] || [ "$branch_name" == 'staging' ] | |
then | |
git commit --allow-empty -m 'empty commit to trigger deployment' | |
fi |
Run this from an ec2 instance in the us-west-1 region.
It will create two queues and feed messages into the first queue with a timestamp, this message will then be read and the difference between the message timestamp and the current time computed and pushed into a response queue. Reading these times will give you the latency between publishing to a queue and receiving the message.
// takes the form field value and returns true on valid number | |
function valid_credit_card(value) { | |
// accept only digits, dashes or spaces | |
if (/[^0-9-\s]+/.test(value)) return false; | |
// The Luhn Algorithm. It's so pretty. | |
var nCheck = 0, nDigit = 0, bEven = false; | |
value = value.replace(/\D/g, ""); | |
for (var n = value.length - 1; n >= 0; n--) { |
var SecurityUtil = (function(key) { | |
var crypto = require('crypto'); | |
var secret=new Buffer(key); | |
var encrypt = function(text) { | |
var cipher = crypto.createCipher('aes-256-cbc', secret); | |
cipher.update(text, 'utf8', 'hex'); | |
var cipherText = cipher.final('hex'); | |
return cipherText; | |
}; |
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: '{AWS_KEY}', | |
secretAccessKey: '{AWS_SECRET}', | |
region: '{SNS_REGION}' | |
}); | |
var sns = new AWS.SNS(); |