Skip to content

Instantly share code, notes, and snippets.

View podlom's full-sized avatar
💻
Working from home

Taras Shkodenko podlom

💻
Working from home
View GitHub Profile
#!/bin/bash
INTERVAL="1" # update interval in seconds
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
echo
@podlom
podlom / .gitignore
Created November 10, 2016 10:38 — forked from salcode/.gitignore
.gitignore file for WordPress - Bare Minimum Git
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore
@podlom
podlom / letsencrypt_2017.md
Created January 29, 2018 09:24 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@podlom
podlom / wp-update.sh
Created February 4, 2020 10:18 — forked from pacoorozco/wp-update.sh
Backup and update a Wordpress Site using wp-cli
#!/usr/bin/env bash
##########################################################################
# Shellscript: Backup and update WordPress using wp-cli
# Author : Paco Orozco <paco@pacoorozco.info>
# Requires : wp-cli
##########################################################################
# Changelog
# 20170125: 1.0
# Adds a default option to upgrade only when it's needed.
# 20161220: 0.1
@podlom
podlom / _bulk_rename.sh
Created August 18, 2023 12:07
Bulk files rename for Ubuntu Linux
#!/bin/bash
# Specify the directory where the files are located
directory="/home/user/Videos/2023-08-18"
# Change to the directory
cd "$directory"
# Iterate over the files matching the pattern and rename them
for file in [0-9]*.mp4; do
@podlom
podlom / _random_strings.php
Last active September 8, 2023 18:43
Random strings generation
<?php
$randomCode = '';
define('STR_LEN', 8);
$characters = array_merge(range('a', 'z'), range(0, 9));
// echo 'The $characters: ' . var_export($characters, true) . PHP_EOL;
@podlom
podlom / style.css
Last active September 22, 2023 15:45
Example style.css for a child WordPress CMS theme
/**
* Theme Name: landing-pagency Child
* Theme URI: https://wordpress.org/themes/landing-pagency/
* Description: landing-pagency Child Theme
* Author: Taras Shkodenko
* Author URI: https://m.shkodenko.com/
* Template: landing-pagency
* Version: 0.0.1
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@podlom
podlom / _break_lines.php
Created October 4, 2023 15:13
Break lines on two equal parts not breaking whole words
<?php
// Check if the input file exists
$inputFile = "_input_file_name.txt";
// Function to break a line into two parts, aiming for equal number of characters, without breaking words
function breakLineEqually($line) {
$length = strlen($line);
$mid = intdiv($length, 2);
@podlom
podlom / _install_team_viewer.sh
Created October 12, 2023 09:16
Install TeamViewer on Ubuntu Linux 22.04
#execute the following command to make yourself as an administrator root user:
sudo su
#first install TeamViewer SSL certificates:
cd /tmp
wget https://download.teamviewer.com/download/linux/signature/TeamViewer2017.asc
sudo apt-key add TeamViewer2017.asc
sudo sh -c 'echo "deb http://linux.teamviewer.com/deb stable main" >> /etc/apt/sources.list.d/teamviewer.list'
#update system packages
@podlom
podlom / _start_prod_db_backup.sh
Last active December 18, 2023 11:19
Start prod db backup
#!/bin/bash
# Set up local and remote credentials
LOCAL_WP_PATH="/nas/content/live/asianlegacylib" # Change to your WordPress directory path
LOCAL_UPLOADS_PATH="${LOCAL_WP_PATH}/wp-content/uploads" # Local uploads directory path
DB_BACKUP_PATH="${LOCAL_WP_PATH}/wp-content/_db_backups" # Local backup directory
DB_BACKUP_NAME="_wp_prod_backup_$(date +%F_%H-%M-%S).sql" # Backup file name with a timestamp
TAR_BACKUP_NAME="${DB_BACKUP_NAME}.tar.bz2" # Tar Backup file name with a timestamp