Skip to content

Instantly share code, notes, and snippets.

View praneetloke's full-sized avatar

Praneet Loke praneetloke

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active May 8, 2024 22:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
// See https://github.com/spinnaker-plugin-examples/springExamplePlugin/blob/master/spring-example-orca/src/main/kotlin/io/armory/plugin/example/spring/SpringExamplePlugin.kt
// The `SpringLoaderPlugin` allows you to use typical Spring constructs inside your plugin
// like classpath component scanning and dependency injection.
class PulumiPlugin(wrapper: PluginWrapper) : SpringLoaderPlugin(wrapper) {
override fun getPackagesToScan(): List<String> = listOf("io.pulumi.plugin.job")
}
@Component
class PulumiJobStage(
destroyJobTask: DestroyJobTask,
@chancez
chancez / example.tf
Last active November 20, 2023 21:56
Support creating a DNS validated ACM certificate containing SANs for multiple different hosted zones
module "combined_acm_certificate" {
source = "../../modules/acm_certificate_dns_validated_multi_zone"
domain_name = "infra.example.com"
zone_to_san = {
"infra.example.com" = [
"*.infra.example.com",
"*.dev.infra.example.com",
"*.staging.infra.example.com",
"*.production.infra.example.com",
@rivo
rivo / serve.go
Created November 26, 2017 12:28
Graceful stop and restart for HTTP servers in Go
package main
import (
"context"
"fmt"
"net"
"net/http"
"os"
"os/exec"
"os/signal"
@vancluever
vancluever / amifind.sh
Created January 26, 2016 08:05
Find the most recent Ubuntu AMI using aws-cli (or any other AMI for that matter)
#!/bin/sh
# Use AWS CLI to get the most recent version of an AMI that
# matches certain criteria. Has obvious uses. Made possible via
# --query, --output text, and the fact that RFC3339 datetime
# fields are easily sortable.
export AWS_DEFAULT_REGION=us-east-1
aws ec2 describe-images \
@aembleton
aembleton / docx2md.md
Last active May 17, 2023 07:04 — forked from vdavez/docx2md.md
Convert a Word Document into MD

Converting a Word Document to Markdown in One Move

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

Installing Pandoc

On a mac you can use homebrew by running the command brew install pandoc.

The Solution

@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update