Skip to content

Instantly share code, notes, and snippets.

@jleskovar-tyro
jleskovar-tyro / module-shim.d.ts
Created August 14, 2021 07:32
Type definitions for node.js vm module API
declare module 'vm' {
import * as Buffer from 'buffer'
import TypedArray = NodeJS.TypedArray
type EvaluateOptions = {
timeout: number
breakOnSigint: boolean
}
export class Module {
@jleskovar-tyro
jleskovar-tyro / bindhack.c
Last active June 1, 2020 02:55
Fork of bindhack.c to work for Mac OSX
/*
A simple LD_PRELOAD hack to let you specify the source address
for all outbound connections or if you want to limit a process
to only listening on one IP
Modified to work on Mac OSX
Copyright (C) 2005 Robert J. McKay <robert@mckay.com>
License: You can do whatever you want with it.
@jleskovar-tyro
jleskovar-tyro / AwsRequestSigningInterceptor.kt
Created July 14, 2019 01:26
Kotlin and AWS SDK v2 port of aws-request-signing-apache-interceptor
/**
* An [HttpRequestInterceptor] that signs requests using any AWS [Aws4Signer] and [AwsCredentialsProvider].
*
* NOTE: Ported to kotlin and v2 SDK from https://github.com/awslabs/aws-request-signing-apache-interceptor/
*/
class AwsRequestSigningInterceptor(
private val region: Region,
private val service: String,
private val signer: Aws4Signer,
private val awsCredentialsProvider: AwsCredentialsProvider