How to convert MP3 to OGG audio format.
ffmpeg -i in.mp3 -ar 48000 -vn -c:a libvorbis out.ogg |
If you have sample rate errors, use -vn.
cloud engineer
How to convert MP3 to OGG audio format.
ffmpeg -i in.mp3 -ar 48000 -vn -c:a libvorbis out.ogg |
ffmpeg -i in.mp3 -ar 48000 -vn -c:a libvorbis out.ogg
If you have sample rate errors, use -vn.
Here’s another way to create a firewall in GCP using network tag as targets.
gcloud compute firewall-rules create "firewall-name" \ --description="egress rule to allow port 8000 to destination" \ --priority "1000" \ --direction EGRESS \ --action allow \ --network "your-network" \ --target-tags="your-network-tag" \ --destination-ranges="10.0.0.1/32" \ --rules tcp:8000 |
gcloud compute firewall-rules create "firewall-name" \ --description="egress rule to allow port 8000 to destination" \ --priority "1000" \ --direction EGRESS \ --action allow \ --network "your-network" \ --target-tags="your-network-tag" \ --destination-ranges="10.0.0.1/32" \ --rules tcp:8000
When you stand up an AWS instance, it’s only accessible via SSH key using the default user, typically ec2-user.
Add password to ec2-user, then enable password authentication to ‘yes’ in SSH.
# Add password to ec2-user sudo passwd ec2-user # edit ssh config vim /etc/ssh/sshd_config # enable password authentication PasswordAuthentication yes # save file and exit |
# Add password to ec2-user sudo passwd ec2-user # edit ssh config vim /etc/ssh/sshd_config # enable password authentication PasswordAuthentication yes # save file and exit
Restart SSH service.
systemctl restart sshd.service |
systemctl restart sshd.service
This is a Bash script to restart a service.
#!/bin/bash SERVICE=google_osconfig_agent AGENT=google-osconfig-agent if (( $(ps -ef | grep -v grep | grep $SERVICE | wc -l) > 0 )) then echo "$AGENT service running, everything is fine" else echo "$AGENT is not running" echo "Restarting service" systemctl start $AGENT sleep 5s if (( $(ps -ef | grep -v grep | grep $SERVICE | wc -l) > 0 )) then sleep 2s echo "$AGENT service is now running" fi fi |
#!/bin/bash SERVICE=google_osconfig_agent AGENT=google-osconfig-agent if (( $(ps -ef | grep -v grep | grep $SERVICE | wc -l) > 0 )) then echo "$AGENT service running, everything is fine" else echo "$AGENT is not running" echo "Restarting service" systemctl start $AGENT sleep 5s if (( $(ps -ef | grep -v grep | grep $SERVICE | wc -l) > 0 )) then sleep 2s echo "$AGENT service is now running" fi fi
This is a Powershell script to restart a service if it’s down.
$ServiceName = 'GCEAgent' $arrService = Get-Service -Name $ServiceName if ($arrService.Status -ne 'Running') { Start-Service $ServiceName write-host $arrService.status write-host 'Service starting' Start-Sleep -seconds 60 $arrService.Refresh() if ($arrService.Status -eq 'Running') { Write-Host 'GCE Agent Service is now Running' } } else { Write-Host 'GCE Agent Service is Running' } |
$ServiceName = 'GCEAgent' $arrService = Get-Service -Name $ServiceName if ($arrService.Status -ne 'Running') { Start-Service $ServiceName write-host $arrService.status write-host 'Service starting' Start-Sleep -seconds 60 $arrService.Refresh() if ($arrService.Status -eq 'Running') { Write-Host 'GCE Agent Service is now Running' } } else { Write-Host 'GCE Agent Service is Running' }