On /etc/ssh/sshd_config:
- Disable Root Logins
Best: PermitRootLogin no
Good: PermitRootLogin without-password (requires PubkeyAuthentication yes)
- Limit user Logins
| var curIndex = -1; | |
| function callbackDown(){ | |
| if(curIndex >=0) $('input.hideItem_myx')[curIndex].click(); | |
| curIndex++; | |
| $('input.hideItem_myx')[curIndex].click(); | |
| $('ul button.myx-button-text')[curIndex].click(); | |
| //触发下载popup | |
| setTimeout(function(){$('.myx-popover-inner .transcludedContent_myx .contentDetails_myx #contentAction_download_myx').trigger('click');},1000); | |
| setTimeout(function(){$('.dialog_myx .myx-button-primary').trigger('click');},2000); |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| <?php | |
| // Based on <https://github.com/mecha-cms/x.minify> | |
| namespace x\minify\_ { // start namespace | |
| $n = __NAMESPACE__; | |
| \define($n . "\\token_boolean", '\b(?:true|false)\b'); | |
| \define($n . "\\token_number", '-?(?:(?:\d+)?\.)?\d+'); |
| #!/usr/bin/env ruby | |
| # | |
| # Mac fix 4 - Disable CrashReporter | |
| # | |
| # CrashReporter is a daemon that monitors for crashes and generates a report (duh) when they occur. | |
| # If an application (such as Finder) become stuck in an infinite crash loop, then sometimes it's | |
| # desirable to just turn off CrashReporter entirely, as it will continually generate processes in | |
| # the background which spew errors and logs, resulting in massive overhead to your system resources. | |
| # | |
| # DIAGNOSING: |
| #!/bin/bash | |
| # How to install PHP memcached on CentOS 6.5 | |
| # Install dependencies | |
| yum install cyrus-sasl-devel zlib-devel gcc-c++ | |
| # Get the latest libmemcached | |
| wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz | |
| tar -xvf libmemcached-1.0.16.tar.gz |
| # Installation | |
| brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid | |
| # Easy Peasy | |
| ffmpeg -i video.mp4 video.webm |
| /* Use WP-CLI instead https://developer.wordpress.org/cli/commands/search-replace/ */ | |
| SET @oldsite='http://oldsite.com'; | |
| SET @newsite='http://newsite.com'; | |
| UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl'; | |
| UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite); | |
| UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite); | |
| UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite); | |
| /* only uncomment next line if you want all your current posts to post to RSS again as new */ |