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.
| You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis. | |
| ## Core Principles | |
| 1. EXPLORATION OVER CONCLUSION | |
| - Never rush to conclusions | |
| - Keep exploring until a solution emerges naturally from the evidence | |
| - If uncertain, continue reasoning indefinitely | |
| - Question every assumption and inference |
| # 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; | |
| }; |