Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / package.json
Last active December 22, 2018 04:40
[Webpack workflow]
{
"name": "webpack-dev",
"version": "1.0.0",
"description": "Webpack development workflow with laravel-mix",
"main": "index.js",
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
@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 / functions.php
Created October 27, 2020 07:48 — forked from justlevine/functions.php
cpt_unique_slug_by_tax.php
<?php
add_filter( 'wp_unique_post_slug', 'cpt_unique_slug_by_tax', 10, 6 );
function cpt_unique_slug_by_tax( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) {
if ( 'guide' === $post_type ) {
global $wpdb;
$post_tax = get_the_terms( $post_ID, 'guide_cat' );
// Check if another CPT exists in the same taxonomy with the same name.
@anwas
anwas / sitesetup.sh
Created July 15, 2021 02:19 — forked from haydar/sitesetup.sh
Bash script to automatically provision LAMP sites
#!/bin/bash
# Bash script to set up local site using LAMP on Ubuntu
# Requires Apache2, MySQL, mkcert (https://github.com/FiloSottile/mkcert)
# See also sitedrop.sh https://gist.github.com/jonattanbossenger/4950e107b0004a8ee82aae8b123cce58
# This version improved by @haydar on github
if [[ $EUID -ne 0 ]];
then