Skip to content

Instantly share code, notes, and snippets.

View anibalardid's full-sized avatar
🏠
Working from home

Anibal anibalardid

🏠
Working from home
View GitHub Profile
find -iname "*.conf" -print | xargs sed -i 's|</Directory>|</Directory>\n\nfirstline\nsecondline\notherlines\n|g'
#!/bin/bash
FOLDER="."
echo "******************************************"
for file in $(find -iname "*.conf")
do
echo "file:" $file
sitename="$(sed s/.conf//g <<< $file)"
sitename="$(sed s/-le-ssl//g <<< $sitename)"
sitename="$(sed -e 's/\.\///g' <<< $sitename)"
find -iname "*.conf" -exec sed -i -e '/<\/Directory>/{r newcontent.txt' -e 'd}' {} \;
@anibalardid
anibalardid / edit-virtualhost.sh
Last active June 26, 2019 18:22
agregar filtro para no poder ejecutar php en carpeta wp-content/uploads
find -iname "*.conf" -print | xargs sed -i 's|</Directory>|</Directory>\n\t<LocationMatch "wp-content/uploads/.*(?i)\.(php)$">\n\t\tOrder Deny,Allow\n\t\tDeny from All\n\t</LocationMatch>\n|g'
#mejora:
find -iname "*.conf" -print | xargs sed -i 's|.(php)|\\.ph\(\?\:p\[345\]\?\|t\|tml\)|g'
#habilitar access log nuevamente
find -iname "*.conf" -print | xargs sed -i 's|\#CustomLog \${APACHE_LOG_DIR}|CustomLog \${APACHE_LOG_DIR}|g'
find -iname "*.conf" -print | xargs sed -i 's|CustomLog \/dev\/null|\#CustomLog \/dev\/null|g'
@anibalardid
anibalardid / add_error_log_vhosts.sh
Created July 26, 2019 15:15
search and add error_log to lsws vhosts
#!/bin/bash
#DIRVHOSTS="/usr/local/lsws/conf/vhosts"
DIRVHOSTS="."
cd $DIRVHOSTS
echo "******************************************"
@anibalardid
anibalardid / phplint.sh
Created August 1, 2019 01:31
php lint and check syntax error
#!/bin/bash
#display error in php lint
find . -name \*.php -exec php -l "{}" \; | grep parsing
@anibalardid
anibalardid / ulauncher-error-github.log
Created August 16, 2019 16:34
ulauncher save github extension preferences error
2019-08-16 13:34:08,491 | INFO | ulauncher.ui.windows.PreferencesUlauncherDialog: prefs_extension_update_prefs() | Update extension preferences: {'pref.kw_search': 'ghsearch', 'callback': '__jp2', 'pref.access_token': '', 'pref.kw': 'gh', 'pref.kw_gists': 'gists', 'id': 'com.github.brpaz.ulauncher-github', 'pref.kw_repos': 'ghrepos'}
2019-08-16 13:34:08,492 | ERROR | ulauncher.ui.windows.PreferencesUlauncherDialog: on_scheme_callback() | Unexpected API error. KeyError: com.github.brpaz.ulauncher-github
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/ulauncher/ui/windows/PreferencesUlauncherDialog.py", line 160, in on_scheme_callback
resp = rt.dispatch(self, scheme_request.get_uri())
File "/usr/lib/python2.7/dist-packages/ulauncher/util/Router.py", line 49, in dispatch
return callback(context, url_params)
File "/usr/lib/python2.7/dist-packages/ulauncher/ui/windows/PreferencesUlauncherDialog.py", line 368, in prefs_extension_update_prefs
controller = ExtensionServer.g
@anibalardid
anibalardid / apt-purge.txt
Created September 6, 2019 18:55
remove residual config apt packages purge
dpkg -l | grep '^rc' | awk '{print $2}' | xargs dpkg --purge
@anibalardid
anibalardid / delete_host_redirect_https.txt
Created September 9, 2019 20:50
chrome redirect localhost to https fix
in chrome:
chrome://net-internals/#hsts
go to the bottom, put url and hit DELETE
@anibalardid
anibalardid / find-directories-more-than-250M.sh
Created September 26, 2019 22:23
Find directories that size is more than 250 MB
du -h -d 1 -t 250M . | sort -hr > more250M.txt