Skip to content

Instantly share code, notes, and snippets.

@varqasim
varqasim / helper.ts
Created September 8, 2023 17:10
Get AWS SQS URL from SQS Arn
export function getQueueUrl(accountId: string, queueArn: string) {
const regex = new RegExp(`${accountId}:`);
const queueName = queueArn.split(regex)[1];
return `https://sqs.${process.env.AWS_REGION}.amazonaws.com/${accountId}/${queueName}`
}
@varqasim
varqasim / haproxy.js
Created January 26, 2021 17:33
Pulumi + ECR + Docker
var pulumi = require("@pulumi/pulumi");
var aws = require("@pulumi/aws");
var awsx = require("@pulumi/awsx");
var stackName =
pulumi.getStack().charAt(0).toUpperCase() + pulumi.getStack().slice(1);
var ecrRepo = new aws.ecr.Repository("haproxy", {
mageScanningConfiguration: {
scanOnPush: true,
@varqasim
varqasim / Dockerfile
Created January 24, 2021 08:22
HAProxy + AWS CloudMap + AWS ECS
FROM haproxy:2.3
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
@varqasim
varqasim / Dockerfile
Created January 23, 2021 23:02
NodeJS "Hello World" Dockerised App
FROM node:12.16.3-alpine
COPY package.json package-lock*.json ./
RUN npm install
COPY . .
RUN npm run build
name: PR Merged
on:
pull_request:
types: [closed]
jobs:
destroy:
name: Destroy Pulumi Stack and Resources
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
name: Pulumi Preview
on:
pull_request:
branches: [master, release, staging, development]
jobs:
preview:
name: Preview
runs-on: ubuntu-latest
steps:
- name: Checkout repo
@varqasim
varqasim / index.js
Last active November 22, 2020 18:12
Create a Pulumi stack on PR creation
var path = require("path");
var { LocalWorkspace } = require("@pulumi/pulumi/x/automation");
// get node command arguments, if the user
// passed `destroy`.
var args = process.argv.slice(2);
var destroy = false;
if (args.length > 0 && args[0]) {
destroy = args[0] === "destroy";
@varqasim
varqasim / .block
Last active December 24, 2019 10:25
Pie Chart
license: mit
@varqasim
varqasim / .block
Created October 21, 2019 09:48
Fast Interactive Canvas Scatterplot
license: mit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VDBCore
{
public class Baggage
{