Posts

Showing posts from August, 2021

Migrate SQLPrompt Snippets to VSCode

 I love snippets; love em. And I have a whole bunch in RedGate SQL Prompt. Now I want to be able to use those in VSCode as well, but boy do I dread having to retype all of them. Solution? Python! First arg is the path where your SQLPrompt snippets are Second arg is the directory where you want it to spit out a "sql.json" file with all your snippets. """ A script to translate sqlprompt snippet files to vscode formatted snippets """ import os import json import glob import io import argparse class SQLPromptPlaceholder :     """Represents the values of a SQLPrompt placeholder"""     def __init__ ( self , name , default_value ):         self . name = name         self . default_value = default_value class SQLPromptSnippet :     """Represents the content of a SQLPrompt snippet"""     @ staticmethod     def from_file ( filename ):         """Generates an instance fr

Fixing Git "Unexpected Disconnect while reading sideband packet"

 I ran into an issue the other day (which my co-worker just ran into as well) when doing a git push, where it fails, saying "RPC failed; HTTP 500 curl 22 The Requested URL returned error: 500 send-pack: unexpected disconnect while reading sideband packet". I found almost no useful articles on the matter; most just talked about adding tracing flags or saying "your internet sucks", neither of which addressed the issue. What fixed it for me was setting the http.postBuffer size to something very large, like git config --global http.postBuffer 157286400 This allowed larger files/repositories or something like that to be posted successfully.

Custom AWS Lambda Layer using NodeJS

Image
AWS Lambda is awesome, and conceptually, layers are awesome too. Layers are a way to share code between lambdas. However I found the documentation on them a little spartan, and some very core use cases were barely documented at all. What I'm going to do in this blog post is walk you through how to: Create a NodeJS Layer with a custom function in it Create a NodeJS Lambda which consumes that layer And I'm going to do it using SAM. Prerequisites: - VSCode - SAM CLI Creating your Project We're going to make a simple app which contains a layer we wish to reuse across a number of lambda functions (even though we'll just do one here). The layer will export a function which reverses a string provided. We'll then create a lambda function which uses that lambda function and passes data form its input event to the function exported by the layer. I'm going to use SAM CLI for this, but really the only thing I'm gaining from that is to stub out a SAM template for me. You