Skip to content

Instantly share code, notes, and snippets.

View mydnic's full-sized avatar
👊
Getting stuff done

Clément Rigo mydnic

👊
Getting stuff done
View GitHub Profile
#!/bin/bash
ip='192.168.0.3'
# START
curl "http://$ip/YamahaRemoteControl/ctrl" -H "Origin: http://$ip" -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: fr,en-US;q=0.8,en;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36' -H 'Content-Type: text/xml' -H 'Accept: */*' -H "Referer: http://$ip/" -H 'Connection: keep-alive' --data-binary '<YAMAHA_AV cmd="PUT"><Main_Zone><Input><Input_Sel>AUDIO2</Input_Sel></Input></Main_Zone></YAMAHA_AV>' --compressed
# STOP
curl "http://$ip/YamahaRemoteControl/ctrl" -H "Origin: http://$ip" -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: fr,en-US;q=0.8,en;q=0.6' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36' -H 'Content-Type: text/xml' -H 'Accept: */*' -H "Referer: http://$ip/" -H 'Connection: keep-alive' --data-binary '<YAMAHA_AV cmd="PUT"><Main_Zone><Input><Input_Sel>AV1</Input_Sel></Input></Main_Zone></YAMAH
@mydnic
mydnic / deploy.sh
Created January 30, 2020 10:22
Zero Downtime deployment bash script
set -e
SITE="domain.com"
DEPL="/home/forge/deployments/${SITE}"
# create directory and any intermediate directories if don't exist
mkdir -p ${DEPL}
CUR="/home/forge/${SITE}"
NEW="${DEPL}/new"
@mydnic
mydnic / plexupdate.sh
Created July 27, 2018 12:04
Bash script to update Plex Media Server on Linux 64bit
#!/bin/bash
# Get Plex Latest Package URL
packageUrl=$(curl -s 'https://plex.tv/api/downloads/1.json' | jq -r '.computer.Linux.releases[0].url')
echo "Latest Package Url: $packageUrl"
# Get the filename
fileName=$(basename $packageUrl)
echo "Filename: $fileName"
@mydnic
mydnic / .bashrc for linux and mac
Last active December 23, 2019 17:23
Linux Aliases
# Directories
alias ..="cd .."
alias ....="cd ../.."
alias nginx="cd /etc/nginx/sites-available"
alias aliasedit="nano ~/.bashrc"
alias aliasreload=". ~/.bashrc"
alias ll="ls -la"
alias cdw="cd /var/www/html"
alias size="du -sh"
@mydnic
mydnic / .bashrc for windows
Last active July 26, 2018 11:40
bashrc file for windows (git for windows)
# Directories
alias ..="cd .."
alias ....="cd ../.."
alias cdw="cd /c/Users/clr/projects"
alias ls='ls -l --color'
# Terminal
alias c="clear"
alias aliasedit="code ~/.bashrc"
alias aliasreload=". ~/.bashrc"
@mydnic
mydnic / moveMusicToFolder.sh
Created November 4, 2016 14:32
Shell script to move all mp3 files into directories having the name of the artist
find . -name "*.mp3" -type f -printf "%f\n" |
while read filename
do
music=${filename%.mp3}
artist=${filename% -*}
if [ -d "$artist" ]; then
mv "$filename" "$artist"
else
mkdir -pv "$artist"
mv "$filename" "$artist"
@mydnic
mydnic / button.blade.php
Last active October 15, 2019 10:44
Simple Like System in Laravel 5
<div ng-app="Actions">
<span ng-controller="LikeController">
@if ($post->user->id != Auth::id())
<button class="btn btn-default like btn-login" ng-click="like()">
<i class="fa fa-heart"></i>
<span>@{{ like_btn_text }}</span>
</button>
@endif
</span>
</div>