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 / Cached-leftpad-custom-function.gs
Created May 31, 2018 23:29
Cached custom function for G Suite / Google Sheets in Apps Script
kch = CacheService.getDocumentCache(); // set up the cache service as a global object
function lp(num){
return ("0000" + num).slice(-2) // elegant
Utilities.sleep(500);
}
/**
* A function to left pad an integert with 0 if less than two digits
@hlecuanda
hlecuanda / ix
Last active July 25, 2021 00:38
zsh implementation of the ix.io pastebin client
#!/usr/bin/env zsh
# _ _
# (_)_ __ (_) ___
# | \ \/ / | |/ _ \
# | |> < _| | (_) |
# |_/_/\_(_)_|\___/
# h@h-lo.me 20190927 144132 -0700 PDT 1569620492 d(-_- )b...
# Zsh implementation of the ix.io pastebin client. Now does more shit
# than the bash version ftw!
#
@hlecuanda
hlecuanda / README.md
Last active February 12, 2018 21:43
Creates a script that stores current `zsh` state. Sourcing that script will reproduce that state on another shell. Awesome for "works for me" diagnostic kind of scenarios

NAME:

reporter

SYNOPSIS:

    source /path/to/reporter [all | aliases | bindings | completion | functions |
                     limits | options | variables | zstyles]

DESCRIPTION:

@hlecuanda
hlecuanda / Makefile
Created January 9, 2018 05:05
Evermake: aself-regenerating portable makefile that makes itself when new sources are added in order to include them, no coding required
LD = gcc
SHELL = /bin/sh
mainx : Makefile
$(LD) -o mainx *.o
clean ::
-$(RM) mainx
Makefile : *.c
@sed -e '/^### Do Not edit this line$$/,$$d' Makefile \
@hlecuanda
hlecuanda / functions_reference.js
Last active October 23, 2017 03:22
Making sense of function expressions, declarations, invocations and incantations :S
//Excerpts from https://dmitripavlutin.com/6-ways-to-declare-javascript-functions/
// also in https://jsbin.com/bozilam
//for reference
// Function Declaration -----------------------------------------------
var count = function(array) { // Function expression
return array.length;
};
var methods = {
@hlecuanda
hlecuanda / flask_server.py
Created October 22, 2017 17:39 — forked from tschieggm/flask_server.py
Stackdriver webhook server example
import string
import sys
import logging
import json
from flask import Flask
from flask import Response, request
logger = logging.getLogger(__name__)
logger.info("Stackdriver webhook-sample starting up on %s" % (string.replace(sys.version, '\n', ' ')))
function assertTrue(expression){
if(true != expression){
throw("Not true");
}
}
function assertFalse(expression){
if(false != expression){
throw("Not false");
}
@hlecuanda
hlecuanda / SocialHistory.js
Last active October 12, 2017 19:12
Social History
/*
* Social Limit - Only the social you care about.
*
* Enables your site to know which social bookmarking badges to display to your
* visitors. It tells you all social sites the user has gone to, or you can
* query for a specific one.
*
* For example:
*
* var sl = SocialHistory();
#!/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
@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
};