Skip to content

Instantly share code, notes, and snippets.

View obar1's full-sized avatar
🏠
Working from home

mar10 obar1

🏠
Working from home
View GitHub Profile
@obar1
obar1 / ka.sh
Created September 27, 2025 11:30
keep alive girthub codespace
#!/bin/bash
# Interval in seconds (e.g., 300 = 5 minutes)
INTERVAL=300
echo "Keeping Codespace alive. Press [CTRL+C] to stop."
while true; do
echo "Ping at $(date)" > /tmp/keepalive.txt
sleep $INTERVAL
@obar1
obar1 / send_pdf.ps1
Created September 27, 2025 11:13
send pdf via mail
# Send all PDFs in the current folder via Outlook
# Save as: Send-PDFs.ps1, then run it from the folder containing the PDFs.
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
$recipient = 'mamatucci@gmail.com'
$subject = "PDFs $(Get-Date -Format 'yyyy-MM-dd HH:mm')"
$body = "Hi,`r`n`r`nPlease find attached all PDF files from: $(Get-Location).`r`n`r`nSent automatically via PowerShell.`r`n"
@obar1
obar1 / rebase_with_git.md
Created September 17, 2025 10:39
rebase_with_git
export MY_BRANCH=feat/DC1121-7769

git switch $MY_BRANCH

if [ "$(git branch --show-current)" = "$MY_BRANCH" ]; then
  echo "✅ You are on branch: $MY_BRANCH"
else
@obar1
obar1 / make_diary.ps1
Last active September 9, 2025 08:40
Creates a dated subfolder in the current directory, adds a readme.md file if missing, and compresses the entire folder into a ZIP backup. Includes error handling for the backup process.
# Creates a dated subfolder in the current directory, adds a readme.md file if missing, and compresses the entire folder into a ZIP backup. Includes error handling for the backup process.
$currentDate = (Get-Date).ToString("yyMMdd")
# TODO: check backupFilePath
$backupFilePath = "$env:USERPROFILE\.bkp\$currentDate.zip"
$currentDirectory = Get-Location
$datedSubfolderPath = Join-Path -Path $currentDirectory -ChildPath $currentDate
$readmeFilePath = Join-Path -Path $datedSubfolderPath -ChildPath "readme.md"
@obar1
obar1 / light git clone.sh
Created August 21, 2025 09:51
light git clone
git clone --depth 1 --branch main
@obar1
obar1 / set_gcp.sh
Last active August 14, 2025 14:32
This Bash script is used to authenticate and configure access to a Google Cloud Platform (GCP) project using the gcloud CLI. It ensures the user provides a project ID, sets it as an environment variable, and then runs a series of GCP authentication and configuration commands.
#!/bin/bash
# Check if a project ID was provided
if [[ "$1" == "--help" || "$1" == "-h" ]]; then
echo "Usage: $(basename "$0") <gcp_project_id>"
echo "This script authenticates and configures gcloud for the specified GCP project."
exit 0
fi
@obar1
obar1 / py_fetch_skillboost.py
Last active July 30, 2025 06:34
simple skillboost html page downloader
import subprocess
import sys
import requests
from pathlib import Path
REPO = "paths_"
WKHTMLTOPDF_PATH = r"C:\git\py_fetch_skillboost\wkhtmltox\bin\wkhtmltopdf.exe"
def fetch_and_save_html(path_id, input_path_html):
url = f"https://partner.cloudskillsboost.google/paths/{path_id}"
@obar1
obar1 / simple_yt_dowloader.py
Last active April 18, 2025 06:28
save yt locally in folder and play via ws
from yt_dlp import YoutubeDL
import os
import json
import html
import re
import http.server
import socketserver
import threading
# Directory to store videos
@obar1
obar1 / rsync wsl2 to dropbox.sh
Created July 6, 2024 08:55
rsync wsl2 to dropbox
rsync -avz --exclude='.git/' --exclude='.venv/' --exclude='__pycache__' --exclude='.pytest_cache' ./kb.oreilly.git/ /mnt/c/Users/mario/Dropbox/kb.oreilly.git
@obar1
obar1 / drop-wsl2-Identifier.sh
Last active June 26, 2024 13:25
drop Identifier
find . -name "*.Identifier" -type f -print0 | xargs -0 rm