Skip to content

Instantly share code, notes, and snippets.

View abfo's full-sized avatar
☁️
Working on an LLM experiment called https://shopstories.us/

Robert Ellison abfo

☁️
Working on an LLM experiment called https://shopstories.us/
View GitHub Profile
@abfo
abfo / Code.gs
Created September 15, 2018 19:08
// add your Google API Project OAuth client ID and client secret here
var ClientID = '';
var ClientSecret = '';
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Google Fit')
.addItem('Authorize if needed (does nothing if already authorized)', 'showSidebar')
.addItem('Get Steps for Yesterday', 'getSteps')
.addItem('Get Steps for past 30 days', 'getHistory')
// load word2vec model
_vocabulary = new Word2VecBinaryReader().Read(HostingEnvironment.MapPath("~/App_Data/GoogleNews-vectors-negative300-SLIM.bin"));
// ... collect all words in post (words is List<string>, not included as implementation specific) ...
double[] vector = new double[_vocabulary.VectorDimensionsCount];
// add all words that exist in the vocabulary
int inVocabularyCount = 0;
foreach(string word in words)
<Custom Action="InstallSS" After="InstallFinalize"><![CDATA[NOT Installed]]></Custom>
<CustomAction Id='InstallSS'
Directory='SystemFolder'
ExeCommand='rundll32.exe desk.cpl,InstallScreenSaver the.scr'
Return='asyncNoWait'/>
public static string OAuthUrlEncode(string s)
{
if (string.IsNullOrEmpty(s))
{
return string.Empty;
}
else
{
StringBuilder sb = new StringBuilder(s.Length);
private const string NoEncodeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
App.Current.DispatcherUnhandledException +=
new DispatcherUnhandledExceptionEventHandler(Current_DispatcherUnhandledException);
AppDomain.CurrentDomain.UnhandledException +=
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
void someEvent_Handler(object sender, SomeEventEventArgs e)
{
if (this.Dispatcher.CheckAccess())
{
// do work on UI thread
}
else
{
// or BeginInvoke()
this.Dispatcher.Invoke(new Action(someEvent_Handler),
private XImage ScanOne()
{
XImage ximage = null;
try
{
// find our device (scanner previously selected with commonDialog.ShowSelectDevice)
DeviceManager manager = new DeviceManager();
DeviceInfo deviceInfo = null;
foreach (DeviceInfo info in manager.DeviceInfos)