Skip to content

Instantly share code, notes, and snippets.

@nestoru
nestoru / keep-printing-not-empty-directory-listing.sh
Last active Oct 10, 2020
keep printing not empty directory listing - bash one liner
View keep-printing-not-empty-directory-listing.sh
dir=$1
while true; do sleep 5; [ ! -z "$(ls $dir)" ] && date && ls -alrt $dir; done
@nestoru
nestoru / ubuntu-flush-dns
Created Jul 14, 2020
Flush DNS in Ubuntu
View ubuntu-flush-dns
sudo systemd-resolve --flush-caches
@nestoru
nestoru / print-older-than-seconds.sh
Created Jun 12, 2020
One liner to find processes that have been running for over any amount of seconds
View print-older-than-seconds.sh
# 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
Docker Unauthorized Incorrect Username Or Password
View DockerUnauthorizedIncorrectUsernameOrPassword.sh
docker logout
docker run hello-world
@nestoru
nestoru / FindTracerouteContainingPackage.sh
Created May 25, 2020
Find Traceroute Containing Package
View FindTracerouteContainingPackage.sh
apt install apt-file
apt-file update
apt-file search traceroute
@nestoru
nestoru / InternationalizeDiviPostTitleModule.php
Created May 25, 2020
Internationalize Divi Post Title Module
View InternationalizeDiviPostTitleModule.php
...
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
...
@nestoru
nestoru / InternationalizeDiviBlurbModule.php
Created May 25, 2020
Internationalize Divi Blurb Module
View InternationalizeDiviBlurbModule.php
...
if ( '' !== $title ) {
$title = sprintf(
'<%1$s class="et_pb_module_header">%2$s</%1$s>',
et_pb_process_header_level( $header_level, 'h4' ),
et_core_esc_previously( $title )
);
// starts blurb i18n patch
$plain_source_title = strip_tags( $title );
$plain_target_title = esc_html__($plain_source_title, 'et_builder');
@nestoru
nestoru / InternationalizeDiviButtonModule.php
Created May 25, 2020
Internationalize Divi Button Module
View InternationalizeDiviButtonModule.php
...
// Render Button
$button = $this->render_button( array(
'button_id' => $this->module_id( false ),
'button_classname' => explode( ' ', $this->module_classname( $render_slug ) ),
'button_custom' => $button_custom,
'button_rel' => $button_rel,
'button_text' => esc_html__( $button_text, 'et_builder' ), // button i18n
...
@nestoru
nestoru / InternationalizeDiviTabsModule.php
Created May 25, 2020
Internationalize Divi Tabs Module
View InternationalizeDiviTabsModule.php
public function get_tabs_nav() {
global $et_pb_tab_titles;
global $et_pb_tab_classes;
$tabs = '';
$i = 0;
if ( ! empty( $et_pb_tab_titles ) ) {
foreach ( $et_pb_tab_titles as $tab_title ){
// The below block is necessary to internationalize the tab titles
You can’t perform that action at this time.