Skip to content

Instantly share code, notes, and snippets.

View YasienDwieb's full-sized avatar

Yasien Dwieb YasienDwieb

View GitHub Profile
@YasienDwieb
YasienDwieb / create-desktop-entry-for-AppImage-on-linux
Last active February 10, 2024 18:59
Create an application launcher for AppImage apps
Place following content with edits in the correct path in a similar directory:
~/.local/share/applications/application.desktop
[Desktop Entry]
Name=App name to be shown
Exec=/opt/apps/app-dir/app.AppImage
Type=Application
Icon=/opt/apps/app-dir/logo.png
@YasienDwieb
YasienDwieb / .docker-aliases
Created January 9, 2023 13:24
Delete docker containers and images by prefix of the name
# Stop and delete all containers matching the provided prefix
# Usage: $ drmall redis
drmall(){
docker ps -a --filter "name=$1*" --format="{{ .Names }}" | xargs docker rm -f {}
}
# Stop and delete all image with repository name matching the provided prefix
# Usage: $ drmiall redis
drmiall(){
docker images --filter "reference=$1*" --format="{{ .ID }}" | xargs docker rmi {}
@YasienDwieb
YasienDwieb / xdebug.ini
Created June 27, 2020 15:05
XDebug tested config
[xdebug]
xdebug.remote_enable=on
xdebug.remote_mode=req
xdebug.remote_autostart=1
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
@YasienDwieb
YasienDwieb / rsync-scp.sh
Last active March 27, 2022 12:32
Sync files with remote server while excluding .git folder
#!/bin/bash
if [ $# -lt 2 ]
then
echo "Usage: $0 <src> <dst> [any-rsync-option]"
exit
fi
rsync -aruvzp --progress --exclude='.git/' $@
@YasienDwieb
YasienDwieb / killProcessesByUsedPort.sh
Last active February 23, 2020 10:13
Solves port already in use issue by killing processes that use that port
#!/bin/bash
if [ $# -eq 0 ]
then
echo "Usage: $0 <port>"
exit
fi
for i in `sudo lsof -i :8080| sed 's/\( \)*/\1/g' | cut -d" " -f2| sort | uniq| egrep -o '[0-9]*'`;do
sudo kill -9 $i
done
@YasienDwieb
YasienDwieb / isomaker.sh
Last active October 20, 2019 12:52
Bulk iso files maker useful for courses archiving for easy transfer and quick view
#!/bin/bash
if [ -z $2 ]; then
echo $0" <source-dir/> <dist-dir/>"
exit
fi
IFS=$'\n'
SOURCE=$1
DEST=$2
for dir in `ls $SOURCE |rev |cut -d '/' -f1 |rev`;do
@YasienDwieb
YasienDwieb / .aliases
Last active September 22, 2019 12:04
Linux most used aliases
# aliases
alias gs='git status'
alias gl="git log --graph --pretty=format:'%C(yellow)%d%Creset %C(cyan)%h%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=short --all"
alias gc='git add . & git commit -m '
@YasienDwieb
YasienDwieb / ar2en.py
Created January 13, 2019 09:43
Franco Arabic onvertor to english (Has been totally copied)
#!/usr/bin/env python
# coding: utf-8
# ar2en.py : Renames arabic files and directories into english recursively
import os
import sys
import shutil
chart = { "أ" : "a" ,
"ا" : "a" ,
@YasienDwieb
YasienDwieb / audio_splitter.sh
Created January 12, 2019 22:08
split audio files into equal pieces using ffmpeg
#!/bin/bash
if [ $# -eq 0 ]
then
echo 'Usage: audiosplitter.sh filename|directory segmenttime'
exit
fi
FILENAME=$1
SEGMENTTIME=$2
@YasienDwieb
YasienDwieb / nlargest.sh
Last active October 20, 2019 12:43
Find largest files or directories
#!/bin/bash
if [ $# -eq 0 ]
then
echo 'Usage:largest.sh file|folder path NUMBEROFRECORDS'
exit
fi
DEST=$2
NUMBEROFRECORDS=10
if [ -n $3 ]