Skip to content

Instantly share code, notes, and snippets.

@codeas
codeas / gas-google-nlp.js
Created March 6, 2018 21:51
GAS Google NLP
/*
* Get sentiment from Google Cloud Natural Language API
*/
var getSentiment = function(text) {
var apiKey = PropertiesService.getScriptProperties().getProperty("apiKey")
var url = "https://language.googleapis.com/v1/documents:analyzeSentiment?key=%KEY".replace("%KEY", apiKey)
var data = {
document: {
language: "en-us",
@nix010
nix010 / base_crawler.py
Last active February 26, 2019 09:49
Crawl pictures from Pinterest by search a keyword | 26 Jan, 2018 (TESED )
from bs4 import BeautifulSoup as BS
import requests
class BaseCrawler(object):
api_url = None
default_headers = {
'Accept-Language' :'en-US,en,q=0.9,vi;q=0.8',
@brainysmurf
brainysmurf / concurrency.gs
Last active February 9, 2025 15:51
Concurrent processing in App Scripts
/**
* Pretends to take a long time to return two rows of data
*
* @param {string} endpoint
* @return {ResponseObject}
*/
function doSomething (endpoint) {
Utilities.sleep(5 * 1000); // sleep for 5 seconds
return {
numberOfRows: 2,
# *-* coding: UTF-8 *-*
import hashlib
import requests
from urllib.parse import urlencode, unquote_plus
def ksort(d):
return [(k, d[k]) for k in sorted(d.keys())]
@mrkrndvs
mrkrndvs / export-named-sheet-as-csv.gs
Last active March 28, 2025 11:27 — forked from mderazon/export-to-csv.gs
Google apps script to export an individual sheet as csv file
/*
* script to export data of the named sheet as an individual csv files
* sheet downloaded to Google Drive and then downloaded as a CSV file
* file named according to the name of the sheet
* original author: Michael Derazon (https://gist.github.com/mderazon/9655893)
*/
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "Download Primary Time File", functionName: "saveAsCSV"}];
@veltman
veltman / README.md
Created September 2, 2017 12:31
SVG animation to video

Converting an SVG animation to a video with the MediaRecorder API and a hidden canvas.

Drawing frames from img elements can introduce an extra delay, so this version generates all the frames upfront and then renders them in a loop with requestAnimationFrame().

See also: Canvas animation to video

import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
@tomkdickinson
tomkdickinson / instagram_followers.py
Created January 5, 2017 20:19
Followers Extraction Instagram
import json
import requests
import logging as log
log.basicConfig(level=log.DEBUG)
class FollowerExtractor():
"""
Extracts followers for a given profile
"""
@codeas
codeas / gas2slack_webhook.js
Last active March 16, 2023 11:24
gas2slack by incoming webhook
function START() {
var url = "https://hooks.slack.com/services/xxxxxx/xxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxxxx";
var payload = {
"channel" : "#test", // <-- optional parameter, use if you want to override default channel
"username" : "robot", // <-- optional parameter, use if you want to override default "robot" name
"text" : "It's working", // <-- required parameter
"icon_emoji": ":robot_face:", // <-- optional parameter, use if you want to override default icon,
//"icon_url" : "http://image" // <-- optional parameter, use if you want to override default icon
@revolunet
revolunet / python-es6-comparison.md
Last active April 11, 2025 10:54
# Python VS JavaScript ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math