Skip to content

Instantly share code, notes, and snippets.

View linglung's full-sized avatar

linglung

  • C+ Java
View GitHub Profile
@linglung
linglung / Logger-AddonUtilities.gs
Last active May 15, 2020 19:28 — forked from mogsdad/Logger-AddonUtilities.gs
Google Apps Script utility functions for persistent logging. See https://mogsdad.wordpress.com/?p=193.
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* AddonUtilities.gs
*
* A collection of general Google-Apps-Script utilities that are useful for
* development of Add-ons.
*
* From: gist.github.com/mogsdad/39db2995989110537868
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
@linglung
linglung / one_level_flatten.js
Created November 7, 2019 15:37 — forked from MauricioMoraes/one_level_flatten.js
Javascript Flatten (for one level nested arrays) - Useful for google apps scripts on spreadsheets
// Takes and array of arrays matrix and return an array of elements.
function flatten(arrayOfArrays){
return [].concat.apply([], arrayOfArrays);
}
@linglung
linglung / gist:3a019876932712988b8526eaa88b2878
Created November 4, 2019 16:56 — forked from mhawksey/gist:3518867
Google Apps Script snippet to run time based triggers during specified periods
function scheduledCollection(){
var schedule = [];
// dates/times in mm/dd/yyyy hh:mm - timezone matches settings in File > Project properties
schedule.push({start:"08/29/2012 15:00", end:"08/29/2012 16:00"});
schedule.push({start:"08/29/2012 20:00", end:"08/29/2012 22:00"});
checkCollect(schedule);
}
function checkCollect(schedule){
var now = new Date();
@linglung
linglung / CardStyleView_inGoogleResult.user.js
Created May 20, 2019 17:28 — forked from yume-yu/CardStyleView_inGoogleResult.user.js
Card style View in Google result for Tampermonkey
// ==UserScript==
// @name Card style View in Google result
// @namespace https://twitter.com/yume_yu
// @homepage https://gist.github.com/yume-yu/0381656dab58175ec64527f04397479c
// @supportURL https://twitter.com/yume_yu
// @version 0.3.4.1
// @description This scripts add cardView to your GoogleSearchResult.
// @author @yume_yu
// @match https://www.google.com/search*
// @grant none
@linglung
linglung / XMLHttpRequest RESTful (GET, POST, PUT, DELETE).user.js
Created May 20, 2019 17:17 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
// ==UserScript==
// @name openrec_add_seek_button
// @namespace http://tampermonkey.net/
// @version 0.3.2
// @description OPENRECのコントロールバーにシークボタンを追加します。また、いくつかのショートカットキーも追加します。
// @author cpthgli
// @match https://www.openrec.tv/live/*
// @grant none
// ==/UserScript==
@linglung
linglung / waitForKeyElements.js
Created May 17, 2019 17:17 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);
@linglung
linglung / google-dorks
Created March 18, 2019 02:07 — forked from stevenswafford/google-dorks
Listing of a number of useful Google dorks.
" _ _ "
" _ /|| . . ||\ _ "
" ( } \||D ' ' ' C||/ { % "
" | /\__,=_[_] ' . . ' [_]_=,__/\ |"
" |_\_ |----| |----| _/_|"
" | |/ | | | | \| |"
" | /_ | | | | _\ |"
It is all fun and games until someone gets hacked!
#!/usr/bin/env python3
triviafile = 'trivia.csv'
apiurl = 'https://opentdb.com/'
sleep_between_requests = 0.1
questionsPerRequest = 50
import requests, os, hashlib, json, sys, csv, urllib, time
unquote = urllib.parse.unquote
@linglung
linglung / GoogleSheetJson.md
Created October 22, 2018 09:42 — forked from ronaldsmartin/GoogleSheetJson.md
Google Spreadsheet JSON Queries

SheetAsJSON + Filtering

This is an extension of DJ Adams' excellent SheetAsJSON Google Apps Script, which provides a way to GET a published Google Spreadsheet as a JSON feed. This version allows generic filtering for terms, more specific control over which rows to parse, and correct MIME type for JSONP output.

Minimal Usage

The following parameters are required for the script to work.

https://script.google.com/macros/s/AKfycbzGvKKUIaqsMuCj7-A2YRhR-f7GZjl4kSxSN1YyLkS01_CfiyE/exec?
+ id=<spreadsheet key>
+ sheet=<sheet name on spreadsheet>