Skip to content

Instantly share code, notes, and snippets.

@AlexDpy
AlexDpy / recursive-rename-some-files.txt
Created August 3, 2016 16:53
recursive rename some files
find . -type f -name "*oldName*" -print0 | while read -r -d '' file; do mv "$file" "${file//oldName/newName}"; done
@AlexDpy
AlexDpy / docker-php-ext-install
Last active November 30, 2015 21:38
docker-php-ext-install
Possible values for ext-name:
bcmath
bz2
calendar
ctype
curl
dba
dom
enchant
exif
@AlexDpy
AlexDpy / ppa repositories
Last active October 29, 2015 13:32
ppa repositories
sudo add-apt-repository X
GIT : ppa:git-core/ppa
PHP : ppa:ondrej/php5-5.6
@AlexDpy
AlexDpy / list disk
Last active October 27, 2015 17:27
linux list disks
lsblk -io NAME,TYPE,SIZE,MOUNTPOINT,FSTYPE,MODEL
lshw -class disk
@AlexDpy
AlexDpy / colors
Created September 29, 2015 10:25
bash profile colors
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
@AlexDpy
AlexDpy / cats
Created September 23, 2015 11:54
php7 cats
echo "Des chats : \u{1F638} \u{1F639} \u{1F63A}\n";
@AlexDpy
AlexDpy / PS1
Created September 23, 2015 11:54
$PS1
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[01;34m\] \w\[\033[33m\]\$(parse_git_branch) \[\033[01;34m\]\$\[\033[00m\] "
@AlexDpy
AlexDpy / php csv export to excel
Last active April 3, 2023 10:59
php csv export to excel
UTF-16LE solution for CSV for Excel by Eugene Murai works well:
$unicode_str_for_Excel = chr(255).chr(254).mb_convert_encoding( $utf8_str, 'UTF-16LE', 'UTF-8');
However, then Excel on Mac OS X doesn't identify columns properly and its puts each whole row in its own cell. In order to fix that, use TAB "\\t" character as CSV delimiter rather than comma or colon.
You may also want to use HTTP encoding header, such as
header( "Content-type: application/vnd.ms-excel; charset=UTF-16LE" );
http://php.net/manual/en/ref.mbstring.php
@AlexDpy
AlexDpy / mocha + coffeescript
Last active October 27, 2015 17:28
Mocha + CoffeeScript
mocha --compilers coffee:coffee-script/register