Skip to content

Instantly share code, notes, and snippets.

@anwas
anwas / linux-screen-commands.txt
Created February 12, 2020 17:09
Linux Screen komandos #workflow #ubuntu #cli #howto
Starting Named Session
Named sessions are useful when you run multiple screen sessions. To create a named session, run the screen command with the following arguments:
screen -S session_name
It’s always a good idea to choose a descriptive session name.
Working with Linux Screen Windows
When you start a new screen session, it creates a single window with a shell in it.
@anwas
anwas / bcp.sh
Last active October 13, 2022 20:05
Linux command line – CLI #chmod #archive #compress #delete #backup
#!/bin/bash
#
# Резервное копирование каталогов и файлов из домашнего каталога
# Этот командный скрипт можно автоматически запускать при помощи cron
#
DATE=`date +%F` # This Command will add date in Backup File Name.
TIME=`date +%H-%M-%S` # This Command will add time in Backup File Name.
COMPNAME=EB
DESDIR=/home/anwas/clouds/nextCloud-eb/personal-share/backups_srv # Destination of backup file.
@anwas
anwas / GIT aliases
Last active February 9, 2023 18:50
[GIT install, config and snippets] #git #snippets #alias
git init
git add .
git commit -a -m "Initial commit"
git tag -a 1.0.0
git tag -n
git checkout -b develop master
git checkout -b feature-clean-footer develop
git checkout develop
@anwas
anwas / multiple-php.txt
Last active December 14, 2023 11:03
[Multiple PHP versions on Ubuntu] #php #dev #ispconfig
## Add repository
### https://launchpad.net/%7Eondrej/+archive/ubuntu/php
### https://launchpad.net/~ondrej/+archive/ubuntu/apache2
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get dist-upgrade
@anwas
anwas / date-time-class-and-functions.php
Last active June 14, 2022 16:18
[Date Time class and functions] #php #date #time #datetime #function #class
<?php
// Patern http://userguide.icu-project.org/formatparse/datetime
// Patern http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
$fmt = new IntlDateFormatter('lt_LT', IntlDateFormatter::FULL,
IntlDateFormatter::NONE, 'Europe/Vilnius', IntlDateFormatter::GREGORIAN, "cccc");
$timestamp = strtotime('now');
$timestamp = strtotime('today');
$timestamp = strtotime('+7 days');
$timestamp = strtotime('next day');
echo datefmt_format( $fmt , time() );
@anwas
anwas / css-grid-gallery-with-fallback.scss
Last active July 1, 2020 08:10
[CSS grid gallery with fallback] #css #css-grid #scss
@anwas
anwas / functions.php
Created January 31, 2018 00:29
[WordPress Include custom template] #wordpress #template #php
<?php
/*
* Include Custom Templates
*************************************************************************** */
function my_custom_template( $template ) {
// patikrinama ar rodomas puslapis yra pasirinktinio tipo įrašų archyvas
if ( ! is_admin() && is_post_type_archive( 'custom-post-type' ) ) {
// įtraukiami reikiami stiliai ir scenarijai
add_action( 'wp_enqueue_scripts', 'my_custom_styles' );
add_action( 'wp_enqueue_scripts', 'my_custom_scripts' );