Skip to content

Instantly share code, notes, and snippets.

@brizzio
brizzio / sample-mongo-commands.json
Created August 25, 2017 14:50 — forked from jatinchauhann/sample-mongo-commands.json
Mondo DB useful commands for beginners. Adapted from a YouTube Video - https://www.youtube.com/watch?v=pWbMrx5rVBE
//after installing mondodb
//cd to the 'bin' directory of the mongodb folder
//run the following commands in the cmd (run as administrator -for Windows)
mongod --directoryperdb --dbpath C:\mongodb\data\db --logpath C:\mongodb\log\mongo.log --logappend --rest --install
//to start the mongodb service
net start MongoDB
//to enter mongodb service (this is necessary to start the mongo service)
mongo
@brizzio
brizzio / README.md
Last active February 20, 2018 20:53
connect a web form to a specific gsheet

The script above will configure your Google Sheet to handle a GET request (function doGet()), tells the spreadsheet where to place the received data (lines 21–38), and sets the allowed MIME type (setMimeType(ContentService.MimeType.JSON)). Give it a read—Will Patera did a great job explaining the script with his comments so I left them in there. (The original gist can be found here.)

Save the script and give it an appropriate name. Then go to the “Run” menu and select “setup.”

You might be asked to give Google Scripts to use your Google account.

Once you’ve given your authorization, go to the “Publish” menu and select “Deploy as web app.”

You will then be presented with a few options with which to customize your script.

function doOCR() {
//
//var folder = DriveApp.getFoldersByName('sanGennaro');
var folder = DriveApp.getFoldersByName('sanGennaro').next();
if(folder){
Logger.log(folder);
var images = folder.getFiles();
Logger.log(images.lenght);
for(i = 0; i < images.length; i++) {
@brizzio
brizzio / gist:a04fd5ceb152fa8ff388ee67b2dc02f8
Created February 22, 2018 21:38
vba code to read a pdf using shell - office 2010
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
@brizzio
brizzio / query-using-header.gs
Last active May 1, 2018 23:30
query google sheet using column name
function columnToLetter(column)
{
var temp, letter = ”;
while (column > 0)
{
temp = (column – 1) % 26;
letter = String.fromCharCode(temp + 65) + letter;
column = (column – temp – 1) / 26;
}
return letter;
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@brizzio
brizzio / Google-Sheet-Form-Post.md
Created February 19, 2019 01:16 — forked from willpatera/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Run example

You should be able to just open index.html in your browser and test locally.

However if there are some permissions errors you can make a quick html server with python. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer. By default this creates a local server at localhost:8000

@brizzio
brizzio / UploaderForGoogleDrive.js
Created August 19, 2019 20:51 — forked from DrPaulBrewer/UploaderForGoogleDrive.js
Upload Browser Blobs to Files in Google Drive API v3
// upload.js, from https://github.com/googledrive/cors-upload-sample
// Contributors Steve Bazyl, Mike Procopio, Jeffrey Posnick, Renaud Sauvain
// License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0
//
// Implements Resumable Upload for Google Drive as described by
// https://developers.google.com/drive/v3/web/resumable-upload
//
// Modified by Paul Brewer, Economic and Financial Technology Consulting LLC
// Nov. 1 2017
// 1. use Google Drive API V3 instead of V2
@brizzio
brizzio / SerialProvider.tsx
Created January 5, 2023 12:12 — forked from joshpensky/SerialProvider.tsx
Web Serial API + React
import {
createContext,
PropsWithChildren,
useContext,
useEffect,
useRef,
useState,
} from "react";
// RESOURCES:
@brizzio
brizzio / Code.gs
Created February 24, 2023 00:38 — forked from HoukasaurusRex/Code.gs
POST data to Google Sheets using Google Scripts
// Original: https://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
// Usage
// 1. Enter sheet name where data is to be written below
var sheetName = 'Users'
// 2. Run > setup
//
// 3. Publish > Deploy as web app
// - enter Project Version name and click 'Save New Version'
// - set security level and enable service (most likely execute as 'me' and access 'anyone, even anonymously)