This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
output="$(sudo ps -eo %cpu,pid --sort -%cpu)" | |
while read -r line; do | |
words=($line) | |
st=$(echo ${words[0]}'>'5 | bc -l) # Change the number '5' to any number kill the processes taking more than that percent of cpu | |
if [ "$st" = "1" ]; | |
then | |
echo ${line} | |
exec sudo kill -9 ${words[1]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pic2vid($picAddresses) | |
{ | |
$prefix = uniqid("app"); //A prefix for temp files | |
foreach ($picAddresses as $key => $picAddress) { | |
copy($picAddress, sys_get_temp_dir() . '/' . $prefix . sprintf('%03d', $key + 1) . '.png'); | |
if ($key == count($picAddresses) - 1) | |
copy($picAddress, sys_get_temp_dir() . '/' . $prefix . sprintf('%03d', $key + 2) . '.png'); | |
} | |
$filename = uniqid(); | |
shell_exec("/usr/local/bin/ffmpeg -framerate 0.5 -i " . sys_get_temp_dir() . '/' . $prefix . "%03d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p " . sys_get_temp_dir() . '/' . $filename . ".mp4 2>&1"); |