Skip to content

Instantly share code, notes, and snippets.

View Google Doc to HTML.js
Convert GoogleDoc To HTML (on Google Drive )
Converting a Google Document to simple HTML
function test_convertGoogleDoc(){
View Find & replace in files within a folder using Google Apps Script.js
// Iterate through the file iterator for a particular folder
function iterateFolderById() {
var files = DriveApp.getFolderById("0B5eEwPQVn6GOaUt6Vm1GVjZmSTQ").getFiles();
while (files.hasNext()) {
var file =;
var doc = DocumentApp.openById(file.getId());
doc.replaceText("My search string or regex", "My replacement string");
suntong / Move a Google Doc into another folder.js
Last active Dec 31, 2015
move a Google Doc into another folder
View Move a Google Doc into another folder.js
How do I move a file to a folder in Google Apps Script?
Yeah, it is a bit odd that Google does not provide a move method.
But, considering how drive works and that a file can belong to
multiple folders, it makes some sense that you have write your own moves.
I should note that this simple function is exactly that ... simple.
suntong / GetFoldersByName.js
Last active Jul 21, 2018
Get folder ID by its name
View GetFoldersByName.js
// Get the *first* folder ID by its name
function getFolderByName(folderName) {
var folders = DriveApp.getFoldersByName(folderName);
var folderID = null;
if (folders.hasNext())
folderID =;
return folderID;
View GDocs2MD.js
Adding this script to your doc:
- Tools > Script Manager > New
- Select "Blank Project", then paste this code in and save.
Running the script:
- Tools > Script Manager
- Select "ConvertToMarkdown" function.
- Click Run button.
- Converted doc will be mailed to you. Subject will be "[MARKDOWN_MAKER]...".
suntong / Google-Picker_Docs.js
Created Dec 20, 2013
Google Picker for Google Docs
View Google-Picker_Docs.js
function doGet() {
var app = UiApp.createApplication();
var selectCkH = app.createServerHandler('selectFile');
var closeHandler = app.createServerHandler('closeDocsPicker');
var docsDialog = app.createDocsListDialog().showDocsPicker()//.setInitialView(google.picker.ViewId.FOLDERS)
// .addView(new google.picker.PhotosView()
// .setType(google.picker.PhotosView.Type.FEATURED))
"\"This is in quotes\""
int d = 3, e, f = 5;
byte z = 22;
double pi = 3.14159;
char x = 'x';
z = (byte) f;
suntong /
Created Feb 1, 2014
overlayfs: mounting overlayfs on top of overlayfs
# The script ( makes a read-only overlayfs mount on top of
# another readonly overlayfs mount, repeating this in a loop,
# when all the read-only filesystems are mounted, then it mounts another
# overlayfs that uses the last read-only rootdir as lowerdir and a read-write
# filesystem in upperdir,
View main.go
package main
import (
View gist:9cb494214aea24c2c5ff

Challenge: select all the people that are:

  • in the 3rd class
  • under age 10
  • female


train[(train['Age'] < 10) & (train['pclass'] == 3) & (train['sex'] == "female")]
You can’t perform that action at this time.