Skip to content

Instantly share code, notes, and snippets.

# "2+2=" | gpt
# outputs: 4
#
# I like to have this in my profile by putting it in %documents%\PowerShell\
# and putting this in Microsoft.PowerShell_profile.ps1:
#
# . "$PSScriptRoot\gpt.ps1"
function Query-Gpt {
[CmdletBinding()]
{
"public_identifier": "jondavis77",
"profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/jondavis77/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20240511%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20240511T000651Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=6b55f178c0ab80360ed207075e592df8bd833e08bbcd409c6c5ee66e6be1f346",
"background_cover_image_url": null,
"first_name": "Jon",
"last_name": "Davis",
"full_name": "Jon Davis",
"follower_count": 181,
"occupation": "Senior Software Developer at LeaseHawk",
"headline": "Software Developer at LeaseHawk",
@stimpy77
stimpy77 / AspNetMvcRazorEmail.cs
Created December 1, 2015 05:44
Send e-mail from ASP.NET MVC Razor View
public class EmailController : Controller
{
// GET: Default
[Route("")]
public ActionResult Index()
{
return RedirectToAction(nameof(SendEmail), new
{
To = "Jon Davis <jon@jondavis.net>",
From ="Phil Whiffenfarts <philwhiffenfarts@gmail.com>",
@stimpy77
stimpy77 / PowerShell_via_MSBuild.md
Last active August 29, 2015 14:27
How to richly enable a PowerShell script in a C# project to run in MSBuild

#How to richly enable a PowerShell script in a C# project to run in MSBuild

  1. Open the .csproj file in Notepad++ (or, right-click the project, choose "Unload Project", then right-click it again and choose "Edit")

  2. Paste the following before the </Project> tag at the end:

     <UsingTask TaskName="InvokePowerShell" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll">
       <ParameterGroup>
           <ScriptFile ParameterType="System.String" Required="true" />
         </ParameterGroup>
    
@stimpy77
stimpy77 / repl.js
Created August 27, 2014 06:04
REPL for nodeJS as function of app
var readline = require('readline');
var trustedEval = eval;
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.prompt(true);
rl.on('line', function (cmd) {
if (((cmd || '').replace(/\s*/g, '')) === '') {