Skip to content

Instantly share code, notes, and snippets.

@gargomoma
gargomoma / tinygs_sensors.yaml
Created October 31, 2023 16:54
A home assistant config package to track your TinyGs station
## Replace [STATION_ID] with your station ID
## you can retrieve it from the URL while checking your station status at tinygs.com
rest:
- resource: "https://api.tinygs.com/v1/station/[STATION_ID]"
scan_interval: 300
sensor:
- name: "TinyGs Satellite"
value_template: "{{ value_json.satellite }}"
- name: "TinyGs ConfirmedPackets"
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- GitLab -->
<remote name="gl" fetch="https://gitlab.com/" />
<!--android_device_google_gsXXX-->
<project path="device/google/gs-common" remote="aosp" name="device/google/gs-common" />
<project path="device/google/gs201" remote="statix" name="android_device_google_gs201" revision="tm-qpr2" />
<project path="device/google/gs201-sepolicy" remote="statix" name="android_device_google_gs201-sepolicy" revision="tm-qpr2" />
<project path="device/google/gs101" remote="statix" name="android_device_google_gs101" revision="tm-qpr2" />
@gargomoma
gargomoma / ssdp.py
Created April 5, 2023 08:02 — forked from dankrause/ssdp.py
Tiny python SSDP discovery library with no external dependencies
# Copyright 2014 Dan Krause
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@gargomoma
gargomoma / extractParam.js
Created February 27, 2023 10:08
exctrac parameters from url
function extractParam(url,param){
var regex = new RegExp(`(?<=${param}=)[^&]+`);
var match = url.match(regex);
if (match) {
const result = match[0];
return result
}
}
@gargomoma
gargomoma / setBQDataSource.js
Created January 20, 2023 12:14
setBQDataSource is a GappS function to build/update your Big Query connections.
/////////////////////////////////////////////////////////////////////////////////
//setBQDataSource is a GappS function to build/update your Big Query connections.
//Ideal if you need to update or create multiple connections, making mantainers life easier.
//Imagination, life is your creation!
/////////////////////////////////////////////////////////////////////////////////
function setBQDataSource(ProjID,Query,SheetName,refreshAllLinkedObjects=true) {
SpreadsheetApp.enableBigQueryExecution(); //.enableAllDataSourcesExecution();
///////////////
var ss = SpreadsheetApp.getActive();
///////////////
@gargomoma
gargomoma / SQL_where_builder.py
Created January 10, 2023 15:44
python code for people that hates to do huge SQL queries
##
##Coming from your friendly neighborhood Spider-Man!
##
def chunkArray(ArrObj, length):
'''Splits a list on a list of lists given a lenght'''
return list(ArrObj[0+i:length+i] for i in range(0, len(ArrObj), length))
def where_in_builder(list_of_elements, var_to_filter,split_by=1_000,is_str=True,return_as_str=True):
'''Builds a IN(...) clause from a list, user can select either a single string or a list of IN(...) for each chunk'''
quotation = "'" if is_str else ""
@gargomoma
gargomoma / pySeleniumGoodies.py
Last active February 24, 2023 16:18
My essential imports and functions to play with Selenium on Python
###My essential imports and functions to play with Selenium on Python
import os
import sys
import threading
import time
import datetime as dt
from selenium import webdriver
from selenium.webdriver.common.by import By
@gargomoma
gargomoma / gDriveLib.py
Last active May 5, 2020 08:35
A simple Python Class to handle basic interactions with GDrive (APIv3).
#Based on: https://github.com/samlopezf/google-drive-api-tutorial/blob/master/google-drive-api-tutorial-project/main.py
from __future__ import print_function
import os, io
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from apiclient.http import MediaFileUpload, MediaIoBaseDownload
@gargomoma
gargomoma / GASEventsToday.gs
Last active June 14, 2022 05:18
Pulls today's events from GCalendar by using getEventsForDay.
/* In case of inconsistencies - Check:
https://stackoverflow.com/questions/11870304/google-apps-script-geteventsforday-returns-invalid-recurring-events
*/
function EventsToday() {
var user = Session.getActiveUser().getEmail(); /*The mail will be sent to the user running the script*/
var startOfDay = new Date();
var events = CalendarApp.getDefaultCalendar().getEventsForDay(startOfDay);
var evlist = 'Hey!! These are the events you have for today<br>';
Logger.log('Number of events: ' + events.length);
@gargomoma
gargomoma / Gihphy4GAS.js
Created October 2, 2018 07:39
Google Apps Script to get random Gif from Giphy
/*
HOW IT WORKS??
https://jeffreyeverhart.com/2016/02/24/using-google-sheet-and-google-apps-script-to-work-with-apis/
https://codepen.io/ChynoDeluxe/pen/WGQzWW
*/
function getGIF() {
// Giphy API defaults
const giphy = {
baseURL: "https://api.giphy.com/v1/gifs/",
key: "APIKEYHERE",