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
<?php | |
/** | |
* This is a regex builder. | |
* Final regular expression finds the js code in the <script> tag. | |
* It is complex because any js code will be found. | |
*/ | |
$jsCodeGroups = []; |
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 | |
function echo_mem_stat () { | |
mem_total="$(free | grep 'Mem:' | awk '{print $2}')" | |
free_mem="$(free | grep 'Mem:' | awk '{print $7}')" | |
mem_percentage=$(($free_mem * 100 / $mem_total)) | |
swap_total="$(free | grep 'Swap:' | awk '{print $2}')" | |
used_swap="$(free | grep 'Swap:' | awk '{print $3}')" | |
swap_percentage=$(($used_swap * 100 / $swap_total)) |
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 | |
# remove exited containers: | |
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v | |
# remove unused images: | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi | |
# remove unused volumes: | |
docker volume ls -f dangling=true | awk '{ print $2 }' | xargs docker volume rm |
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 | |
INSTALL_DIR=/opt/postman | |
if [ "$(whoami)" != "root" ] | |
then | |
echo "Sorry, you are not root. Use sudo!" | |
exit 1 | |
fi |
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 | |
# | |
# Based on https://gist.github.com/olivertappin/e5920e131db9a451c91aa6e2bc24dc40 | |
# | |
INSTALL_DIR=/opt/phpstorm | |
if [ "$(whoami)" != "root" ] | |
then |
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
# config/consumers.yml | |
# {consumer_name}: {how many processes to start} | |
consumers: | |
my_consumer_1: 1 | |
my_consumer_2: 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
namespace :symfony do | |
namespace :parameters do | |
desc "Create parameters.yml file based on the parameters.yml.dist one. Ask for all parameters." | |
task :create do | |
on roles(:all) do | |
if not test("[ -f #{shared_path}/app/config/parameters.yml ]") | |
distParameters = YAML::load(capture("cat #{release_path}/app/config/parameters.yml.dist")) | |
parameters = { "parameters" => {} } | |
distParameters['parameters'].each do |k,v| |