This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: Witty/Witty/ConsoleWindow.xaml | |
=================================================================== | |
--- Witty/Witty/ConsoleWindow.xaml (revision 0) | |
+++ Witty/Witty/ConsoleWindow.xaml (revision 0) | |
@@ -0,0 +1,15 @@ | |
+<Window x:Class="Witty.ConsoleWindow" | |
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
+ xmlns:core="clr-namespace:Core;assembly=Core" | |
+ Title="ConsoleWindow" Height="800" Width="500"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Windows.Controls; | |
using System.Windows.Media; | |
using System.Xml.Linq; | |
using Microsoft.Maps.MapControl; | |
namespace Map | |
{ | |
public partial class MainPage : UserControl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq.Expressions; | |
using System.Runtime.CompilerServices; | |
using Microsoft.CSharp.RuntimeBinder; | |
namespace ConsoleApplication1 { | |
class MyTarget { | |
public int Foo() { return 1; } | |
public int Foo(int x) { return x; } | |
public int Foo(int x, string y) { return x; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static object InvokeInstanceMethod(object thisParameter, string methodName, Type[] typeArguments, params object[] args) { | |
CSharpArgumentInfo[] parameterFlags = new CSharpArgumentInfo[args.Length + 1]; | |
Expression[] parameters = new Expression[args.Length + 1]; | |
var thisParameterFlags = CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null); | |
parameterFlags[0] = thisParameterFlags; | |
parameters[0] = Expression.Constant(thisParameter); | |
for (int i = 0; i < args.Length; i++) { | |
parameterFlags[i + 1] = CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.Constant | CSharpArgumentInfoFlags.UseCompileTimeType, null); | |
parameters[i + 1] = Expression.Constant(args[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' How to setup this macro: | |
' | |
' Assumes you have 3 folders setup called Archives, Followup P1 and Followup P2 | |
' To setup key bindings: | |
' 1. Hit ALT-F11 to open the VBA Window | |
' 2. Right-click on Project1 and select Insert/New Module | |
' 3. Paste this gist into the Module and save | |
' 4. Right-click on the top-most toolbar in VS (above the File/Home/Send ... menu) - this is called the Quick Access Toolbar | |
' 5. The Outlook Options dialog appears. On the Choose commands from: dropdown, select Macros. You'll see your macros there. | |
' 6. Add the macros to the toolbar by clicking on the Add >> button. The first macro on the list is bound to ALT-1, second ALT-2 etc. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To run you'll need some secrets: | |
# 1. SERPAPI_API_KEY secret in env var - get from https://serpapi.com/ | |
# 2. OPENAI_API_KEY secret in env var - get from https://openai.com | |
import streamlit as st | |
import json, os | |
from langchain.prompts import PromptTemplate | |
from langchain.llms import OpenAI | |
from serpapi import GoogleSearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
import pandas as pd | |
from langchain.prompts import PromptTemplate | |
from langchain.llms import OpenAI | |
from IPython.display import display, Markdown | |
llm = OpenAI(temperature=0.2, max_tokens=1000) | |
prompt = PromptTemplate( | |
input_variables=[ | |
"df_name", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Updated version which uses Bing Search API (you'll need to sign up - free | |
# tier available) It also uses the Azure OpenAI service. | |
import streamlit as st | |
import json, os, requests, openai | |
from langchain.prompts import PromptTemplate | |
# You'll only need this for public OpenAI endpoint | |
openai.api_key = os.environ["OPENAI_API_KEY"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64, chess.svg, re, stockfish, openai, os | |
import streamlit as st | |
from streamlit_chat import message | |
from langchain.prompts import PromptTemplate | |
chess_move_regex = re.compile(r"([KQBNR]?[a-h]?[1-8]?x?[a-h][1-8])([+#]?|=[QBNR])") | |
CHARACTER = "Yoda" | |
house_prompt = PromptTemplate( | |
input_variables=["character", "my_move", "your_move"], |
OlderNewer