Skip to content

Instantly share code, notes, and snippets.

View Eddy-Barraud's full-sized avatar

Eddy Barraud Eddy-Barraud

View GitHub Profile
@Eddy-Barraud
Eddy-Barraud / audio-convert.sh
Last active May 16, 2018 16:28
Convert every audio files inside the current directory to mp3
#!/bin/bash
find . -regex ".*\.\(opus\|ogg\|m4a\)" -print0 |
while IFS= read -r -d $'\0' filename; do
echo $filename
name="${filename%.*}"
< /dev/null ffmpeg -nostats -loglevel 0 -n -i "$filename" -b:a 0 -codec:a libmp3lame -vn "./$name.mp3"
done
@Eddy-Barraud
Eddy-Barraud / images_comrpess.sh
Last active October 6, 2018 16:20
Compress every images recursively with options to say quality & root path. Require jpegoptim & optipng
#!/bin/bash
usage()
{
echo "Usage: sh images_compress.sh -d /directory -q 60"
exit
}
while [ "$1" != "" ]; do
case $1 in
-d ) shift
DIRECTORY=$1
@Eddy-Barraud
Eddy-Barraud / ram_disk_create.sh
Created May 16, 2018 14:57
Sync ram disk with hard disk & mount it
mkdir /ramdisk
mount -t tmpfs -o size=2048M tmpfs /ramdisk
or copy inside /etc/fstab
tmpfs /media/ramdisk tmpfs rw,size=2048M 0 0
And do :
mount -a
@Eddy-Barraud
Eddy-Barraud / tmux_watch.sh
Created May 16, 2018 15:01
Start a tmux with top - hour - iftop ; uses panes ;
#!/bin/bash
source /root/.bashrc
tmux kill-session -t watch
tmux new -d -s watch
tmux send-keys -t watch:0.0 'tmux split-window -h' ENTER
tmux send-keys -t watch:0.0 'tmux split-window' ENTER
tmux send-keys -t watch:0.0 'tmux split-window' ENTER
sleep 1
tmux send-keys -t watch:0.1 'top' ENTER
tmux send-keys -t watch:0.2 'iftop' ENTER
@Eddy-Barraud
Eddy-Barraud / .bash_aliases
Created May 16, 2018 15:06
Usefull bash aliases : location in ~/.bash_aliases
alias header='curl -I --insecure'
alias top='top -d1'
alias ttfb='curl -o /dev/null -w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n"'
alias avg='cat /proc/loadavg'
alias cs='pidstat -hw | head -3 && pidstat -hw | tail -n +3 | sort -nr -k 4 | head -n 10'
alias pflog='cat /var/log/mail.log | /root/scripts/pflogsumm-1.1.1/pflogsumm.pl'
alias logmail='tail -f /var/log/mail.log'
alias dl='aria2c -x5'
alias ngxreport='goaccess -f /var/log/nginx/access.log -a > report.html'
@Eddy-Barraud
Eddy-Barraud / Management Consoles
Created May 16, 2018 15:10
Windows shortcuts - Environment - Run cmd - Shell - Management Consoles -
certmgr.msc - Certificate Manager
ciadv.msc - Indexing Service
compmgmt.msc - Computer management
devmgmt.msc - Device Manager
dfrg.msc - Defragment
diskmgmt.msc - Disk Management
fsmgmt.msc - Folder Sharing Management
eventvwr.msc - Event Viewer
gpedit.msc - Group Policy (< XP Pro)
iis.msc - Internet Information Services
@Eddy-Barraud
Eddy-Barraud / playlist-all.sh
Created May 16, 2018 15:19
Create a Playlist of every songs inside every folders present at current directory
#!/bin/bash
#
# bash script to create playlist files in music subdirectories
# This one will aggregate every sonds inside only one same playlist
# Steve Carlson (stevengcarlson@gmail.com)
rm -f all.m3u
find . -type d |
while read subdir
do
# rm -f "$subdir"/*.m3u
@Eddy-Barraud
Eddy-Barraud / social_buttons_svg.html
Last active September 28, 2018 16:26 — forked from ishu3101/social_share.csv
Social Share URL
<style>
.resp-sharing-button__link,
.resp-sharing-button__icon {
display: inline-block
}
.resp-sharing-button__link {
text-decoration: none;
color: #fff;
}
@Eddy-Barraud
Eddy-Barraud / download_webpage.sh
Created May 17, 2018 14:53
Download a webpage with wget recursively
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains www.domain.com \
--no-parent \
www.domain.com
#COPY FILES TO THE PROGRAM DIR
New-Item -ItemType Directory -Force -Path "${env:programfiles(x86)}\Aria2\"
Copy-Item aria2c.exe "${env:programfiles(x86)}\Aria2\"
Copy-Item installer.ps1 "${env:programfiles(x86)}\Aria2\"
Copy-Item nssm.exe "${env:programfiles(x86)}\Aria2\"
#Install the service
##Verify that it's not already installed
sc.exe stop aria2c-rpc
sc.exe delete aria2c-rpc
sleep 2