Skip to content

Instantly share code, notes, and snippets.

View greenido's full-sized avatar
🏃‍♂️
Running with a big smile

Ido Green greenido

🏃‍♂️
Running with a big smile
View GitHub Profile
@greenido
greenido / GPT to Google Doc Formater.js
Last active May 20, 2024 21:37
convert raw output of GPT to a better google doc format - mainly for trip planning
//
// Change the main headlines (###) to Headline #2
//
function changeLinesToHeading2() {
// Get the active document
var doc = DocumentApp.getActiveDocument();
// Get the body of the document
var body = doc.getBody();
// Iterate through all paragraphs in the document
@greenido
greenido / getStavaToken.md
Created May 17, 2024 01:48
How to get a token for Strava API calls requiring OAuth

To get a token for Strava API calls requiring OAuth, you'll need to follow these steps:

1. Register Your Application:

  • Visit the Strava developer portal: https://developers.strava.com/
  • Create a developer account and register your application.
  • During registration, you'll receive a Client ID and Client Secret. These are essential for obtaining access tokens.

2. User Authorization:

// First let's call the 'angles'
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// Second, give this jQuery script time to load and:
jQuery.noConflict();
@greenido
greenido / fetchXrayViolations.js
Last active February 26, 2024 12:48
Fetch JFrog Xray violations into CSV so you can use them in an external monitoring/logging tool
//
// Fetch Xray Data into CSV and later any DB/Logging/Monitoring tool you wish.
//
// @author: Ido Green | @greenido
// @date: March 2020
//
// @see:
// https://greenido.wordpress.com/2019/12/04/how-to-build-an-integration-with-jfrog-xray/
// https://greenido.wordpress.com/2020/02/12/continuous-software-updates/
//
// Find all buttons with data-testid="job-artifacts-delete-button"
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
// Function to click on the second button within the pop-up
const clickSecondButtonInPopup = async () => {
const secondButton = document.querySelector('.btn.js-modal-action-primary.btn-danger.btn-md.gl-button');
// If the second button is found, click on it
if (secondButton) {
secondButton.click();
} else {
@greenido
greenido / notes-IndexedDB.html
Created September 23, 2012 09:37 — forked from cfjedimaster/gist:2499973
Simple indexedDB example that will work both in Chrome and FF
<!DOCTYPE html>
<head>
<script>
var db;
// until we won't need this prefix mess
var indexedDB = window.indexedDB || window.webkitIndexedDB
|| window.mozIndexedDB || window.msIndexedDB;
var IDBTransaction = window.IDBTransaction ||
window.webkitIDBTransaction;
@greenido
greenido / AI_LLM_Research_Stuff.md
Last active August 5, 2023 00:30
Some notes around LLMs , local LLM , fine tuning etc'
@greenido
greenido / maintenance.sh
Created August 2, 2023 22:52
A shell script to automate system monitoring, maintenance and email you the results
#!/bin/bash
# System Maintenance Script
# Create log file
log=/var/log/maintenance.log
# Print start status
echo "$(date) - Starting system maintenance" >> $log
@greenido
greenido / remoteCopy.sh
Created August 2, 2023 22:00
A shell script that accesses a server over SSH and copies a specific directory
#!/bin/bash 
# Set the variables. 
server_ip="192.168.1.100" 
username="user" 
password="passwd" 
source_directory="/home/user/my_directory" 
destination_directory="/opt/my_directory" 
# Connect to the server. 
@greenido
greenido / backup.sh
Created August 2, 2023 21:59
This bash script will back up all the files in the current directory to a .tar.gz file. 
#!/bin/bash 
# This script will back up all the files in the current directory to a .tar.gz file. 
# Get the current date and time. 
date +"%Y-%m-%d_%H:%M:%S" 
# Create a backup file. 
backup_file="backup_$(date +"%Y-%m-%d_%H:%M:%S").tar.gz" 
# Tar up all of the files in the current directory.