This file contains 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
# Add to your profile the following bash function | |
# Use it with this command: git commit -m "$(summarize_git_diff)" | |
# To confirm how the commit message will look like: git log -1 | |
export OPENAI_API_KEY='your openai api key' | |
summarize_git_diff() { | |
# Capture the full git diff (staged changes) without using a pager | |
local diff_file chunk_dir chunk_prefix final_summary chunk payload response chunk_summary | |
diff_file=$(mktemp) | |
git --no-pager diff --cached > "$diff_file" |
This file contains 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
#!/bin/bash | |
# /opt/scripts/tree-gitignore.sh | |
# Author: Nestor Urquiza | |
# Date: 20240220 | |
# Description: A tree wrapper to show contents of a git project respecting .gitignore | |
# Usage: cd git-project && /opt/scripts/tree-gitignore.sh | |
cmd="tree -a -I '.git'" |
This file contains 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
#!/usr/bin/env python3 | |
# | |
# clichatgpt.py | |
# | |
# A CLI script to interact with ChatGPT via API | |
# | |
# Nestor Urquiza 20230512 | |
# | |
import sys | |
import openai |
This file contains 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
#!/bin/bash -e | |
# mongo-collection-to-csv.sh | |
# | |
# description: Exports all field from any mongodb collection to CSV | |
# author: Nestor Urquiza | |
# date: 20210218 | |
# env vars | |
password=$MONGODB_PWD |
This file contains 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
dir=$1 | |
while true; do sleep 5; [ ! -z "$(ls $dir)" ] && date && ls -alrt $dir; done |
This file contains 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
sudo systemd-resolve --flush-caches |
This file contains 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
# One liner to find processes that have been running for over any amount of seconds | |
SECONDS=$1 | |
ps -e -o "pid,etimes,command" | awk '{if($2>$SECONDS) print $0}' | |
: ' | |
Explanation: | |
=========== | |
ps: process snapshot command | |
-e: list all processes | |
-o: include only specified columns |
This file contains 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
apt install apt-file | |
apt-file update | |
apt-file search traceroute |
This file contains 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
... | |
if ( $multi_view->has_value( 'title', 'on' ) ) { | |
if ( is_et_pb_preview() && isset( $_POST['post_title'] ) && wp_verify_nonce( $_POST['et_pb_preview_nonce'], 'et_pb_preview_nonce' ) ) { | |
$post_title = sanitize_text_field( wp_unslash( $_POST['post_title'] ) ); | |
} else { | |
$post_title = esc_html( et_builder_get_current_title() ); | |
} | |
$post_title = esc_html__($post_title, 'et_builder'); // post title i18n fix | |
... |
NewerOlder