This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ui = SpreadsheetApp.getUi(); | |
function onOpen(e){ | |
ui.createMenu("Gmail Manager").addItem("Get Emails by Label", "getGmailEmails").addToUi(); | |
} | |
function getGmailEmails(){ | |
var input = ui.prompt('Label Name', 'Enter the label name that is assigned to your emails:', Browser.Buttons.OK_CANCEL); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from collections import Counter | |
random.seed(3) | |
pizzas = ['caipira', 'portuguesa', 'pepperoni', '4 queijos'] | |
print(Counter([random.sample(pizzas, 1)[0] for r in range(1000)])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IPython.core.debugger.Pdb.set_trace() | |
# DeprecationWarning: `Tracer` is deprecated since version 5.1, directly use `IPython.core.debugger.Pdb.set_trace()` | |
from IPython.core.debugger import Tracer; Tracer()() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste it in your console and change the url to your needs. | |
function logout(to_url) { | |
var out = window.location.href.replace(/:\/\//, '://log:out@'); | |
jQuery.get(out).error(function() { | |
window.location = to_url; | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import gcd | |
from functools import reduce | |
# or | |
# def gcd(a, b): | |
# """Return greatest common divisor using Euclid's Algorithm.""" | |
# while b: | |
# a, b = b, a % b | |
# return a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# credits for -> https://www.sisense.com/blog/exact-row-counts-for-every-database-table/ | |
CREATE OR REPLACE FUNCTION | |
count_rows(schema text, tablename text) RETURNS integer | |
AS | |
$BODY$ | |
DECLARE | |
result integer; | |
query varchar; | |
BEGIN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Create Instance in AWS | |
hosts: localhost | |
connection: local | |
gather_facts: false | |
vars: | |
aws_access_key: "xxxxxx" | |
aws_secret_key: "xxxxxx" | |
security_token: "xxxxxx" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Name: ansible-aws-inventory-main.yml | |
# Description: this is the main file that calls the worker file (ansible-aws-inventory-worker.yml) to create an inventory of all the | |
# specific aws resources. | |
# Below are the resources that will be inventoried | |
# - vpc | |
# - subnet | |
# - igw | |
# - cgw | |
# - vgw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name: ansible-aws-inventory-worker.yml | |
# Description: this is the worker file that called the main file (ansible-aws-inventory-main.yml) to to create an inventory of all the | |
# specific aws resources. This file, the worker file and the ansible inventory file must be placed in the same folder | |
# Prerequisites: | |
# - the worker file (ansible-aws-inventory-worker.yml) and the ansible hosts file must be present in the same folder as this file (ansible-aws-inventory-main.yml) | |
# - this script requires read access to all resources it will be querying. An AWS IAM user account must be created with the necessary permissions and with access keys enabled. | |
# At a minimum, to query all the resources mentioned above, the following permissions are required | |
# - AmazonVPCReadOnlyAccess | |
# - AmazonEC2ReadOnlyAccess | |
# - ElasticLoadBalancingReadOnly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:3.7 | |
ENV AWSCLI_VERSION "1.14.10" | |
RUN apk add --update \ | |
python \ | |
python-dev \ | |
py-pip \ | |
build-base \ | |
&& pip install awscli==$AWSCLI_VERSION --upgrade --user \ |