Skip to content

Instantly share code, notes, and snippets.

nu@Nestors-MacBook-Air bash-code % cat ~/Downloads/conectadrive-frontend-tweaks-sandbox/index5.html
<html lang="es" dir="ltr" data-lt-installed="true" style="
display: flex;
"><head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Driver Management</title>
<link rel="icon" href="/faviconConecta.png">
<style data-fullcalendar=""></style><link href="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css" rel="stylesheet">
@nestoru
nestoru / tree-gitignore.sh
Created February 20, 2024 12:09
cd git-project && /opt/scripts/tree-gitignore.sh
#!/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'"
@nestoru
nestoru / clichatgpt.py
Created May 12, 2023 08:06
A CLI script to interact with ChatGPT via API
#!/usr/bin/env python3
#
# clichatgpt.py
#
# A CLI script to interact with ChatGPT via API
#
# Nestor Urquiza 20230512
#
import sys
import openai
@nestoru
nestoru / mongo-collection-to-csv.sh
Last active February 18, 2021 00:06
mongo-collection-to-csv.sh
#!/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
@nestoru
nestoru / keep-printing-not-empty-directory-listing.sh
Last active October 10, 2020 11:22
keep printing not empty directory listing - bash one liner
dir=$1
while true; do sleep 5; [ ! -z "$(ls $dir)" ] && date && ls -alrt $dir; done
@nestoru
nestoru / ubuntu-flush-dns
Created July 14, 2020 18:17
Flush DNS in Ubuntu
sudo systemd-resolve --flush-caches
@nestoru
nestoru / print-older-than-seconds.sh
Created June 12, 2020 10:19
One liner to find processes that have been running for over any amount of seconds
# 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
@nestoru
nestoru / DockerUnauthorizedIncorrectUsernameOrPassword.sh
Created May 25, 2020 15:05
Docker Unauthorized Incorrect Username Or Password
docker logout
docker run hello-world
@nestoru
nestoru / FindTracerouteContainingPackage.sh
Created May 25, 2020 15:03
Find Traceroute Containing Package
apt install apt-file
apt-file update
apt-file search traceroute
@nestoru
nestoru / InternationalizeDiviPostTitleModule.php
Created May 25, 2020 15:01
Internationalize Divi Post Title Module
...
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
...