Skip to content

Instantly share code, notes, and snippets.

View hlecuanda's full-sized avatar
😡
Mirroring gitlab on ActiveGithub.NET 2019 Ultimate Enterprise EULA Live

H-Lo hlecuanda

😡
Mirroring gitlab on ActiveGithub.NET 2019 Ultimate Enterprise EULA Live
View GitHub Profile
@hlecuanda
hlecuanda / .block
Last active December 15, 2016 10:00
Schema.org Collapsible Tree
license: gpl-3.0
@hlecuanda
hlecuanda / vax.sh
Created January 5, 2017 20:29
XTerm reference scripts
#!/bin/sh
# vax
# 09-17-96 Bob Ess - initial creation
# 09-26-96 Shig Katada - Additional keybindings
#
# Script file to incorporate keybindings and command line
# options for connecting to a VAX node
# Usage statement
@hlecuanda
hlecuanda / .Xresources
Created January 5, 2017 20:34
Setup Function keys for XTerm
!! Call xterm like so:
!!
!! xterm $XTERMFLAGS +rw +sb +ls $@ -tm 'erase ^? intr ^c' \
!! -name vt220 -title vt220 -tn xterm-220 "$@" &
!!
XTerm*VT100.translations: #override \n\
<Key>Home: string(0x1b) string("[3~") \n \
<Key>End: string(0x1b) string("[4~") \n
vt220*VT100.translations: #override \n\
~Shift <Key>F1: string(0x1b) string("OP") \n \
@hlecuanda
hlecuanda / GAE-reverse-proxy-for-sites.py
Created April 2, 2017 03:21
A reverse proxy, to enable custom domain names on the new google sites; using Google App Engine
# -*- coding: utf-8 -*-
# Based on http://flask.pocoo.org/snippets/118/
from flask import Flask
from flask import Response
from flask import stream_with_context
import requests
app = Flask(__name__)
@hlecuanda
hlecuanda / Changelog.gs
Created June 12, 2017 20:05
Log changes to a google spreadsheet (changelog sheet)
function onEdit() {
// This script records changes to the spreadsheet on a "Changelog" sheet.
// The changelog includes these columns:
// "Timestamp", "Sheet name", "Cell address", "Column label", "Row label", "Value entered"
// Version 1.1, written by --Hyde, 30 July 2014
// See https://productforums.google.com/d/topic/docs/7CaJ_nYfLnM/discussion
// edit the following lines to suit your needs
// changes are only recorded from sheets listed below
// escape regular expression metacharacters as in \. \$ \+ \* \? \( \) \[ \]
@hlecuanda
hlecuanda / StackTraces-Logging-GAS.md
Last active May 3, 2023 09:30
Example using Stackdriver logging for debugging a custom function for sheets in Google Apps Script. / Writing a Caching custom function

Logging custom functions using stackdriver in google apps script

Recently, console logging became available for Google Apps Script projects. It used to be impossible to use the Log service that comes with the GAS runtime, but now all you need to do is throw an exception. Exceptions get logged in stackdriver logging and when enabled, unhandled exceptions will not stop your script execution. This adds up to nearly 0 lag if you are using this feature (?) by purposely throwing exceptions, and you can get creative with your error message to avoid having to expand stackdriver's log messages (which are pretty comprehensive stacktraces!)

Setup

Keybase proof

I hereby claim:

  • I am hlecuanda on github.
  • I am hlecuanda (https://keybase.io/hlecuanda) on keybase.
  • I have a public key whose fingerprint is B67A 1066 07FB F278 7A74 1F18 8666 B944 3E6B 25DF

To claim this, I am signing this object:

@hlecuanda
hlecuanda / AlternatingColorsOnRowGroups.gs
Last active March 13, 2020 03:10
Alternate colors and add a separator on column value change. Google Sheets Google Apps Script
/**
* @OnlyCurrentDoc Limits the script to only accessing the current spreadsheet.
*/
/**
* After installing, select a column where the values repeat on each row, for example
* a flattened table with dates, invoice numbers, and invoice lines. like this:
*
* Date |Invoice#| PartNo |Descr ....
* 2017-01-15 | 123456 | ACME-WCMCI-1 | ACME WHATCHAMACALLIT 1
@hlecuanda
hlecuanda / Code.gs
Created September 27, 2017 02:59
Get data from BigQuery into Google Sheets. Google Apps Scrpt
function runQuery(querySelector) {
// Replace this value with the project ID listed in the Google
// Cloud Platform project.
var projectId = 'your-project-id-not-project-name';
if (querySelector){ // be creative, construct your own dynamic query with parameters. or something
var request = {
query: 'SELECT * FROM project.dataset.table',
useLegacySql: false // set to true to use strange sql from the past
};
#!/usr/bin/env python
# −*− coding: UTF−8 −*−
# Las dos lineas anteriores se aseguran #1 de localizar el
# interpretador para poder usar el script directamente
# y #2 de definir la codificacion de la fuente. Solo es
# buena educacion, =)
#import sys # con argparse y la linea shebang! (#!) ya no lo ocupas
import argparse # modulo utilisimo para lineas de comando
import RPi.GPIO as GPIO