Skip to content

Instantly share code, notes, and snippets.

root@ip-172-31-42-73:/etc/cron.d# more /usr/lib/php5/maxlifetime
#!/bin/sh -e
max=1440
if which php5 >/dev/null 2>&1; then
for sapi in apache2 apache2filter cgi fpm; do
if [ -e /etc/php5/${sapi}/php.ini ]; then
cur=$(php5 -c /etc/php5/${sapi}/php.ini -d "error_reporting='~E_ALL'" -r 'print ini_get("session.gc_maxlifetime");')
[ -z "$cur" ] && cur=0
@ryanaslett
ryanaslett / pasteboard
Created September 1, 2015 17:54
Put this somewhere in your path. Phpstorm has a hard time with proper escaping because it cannot handle shell pipes etc. Easier to just give it the script to run.
#!/bin/bash
pbcopy <<< $1
#!/bin/bash
export DCI_DrupalciBranch=production
export DCI_RunScript=/var/www/html/core/scripts/run-tests.sh
export DCI_PHPVersion=5.5
export DCI_JobType=simpletest
export BUILD_TAG=jenkins-DCI_XML-113
export DCI_ComposerInstall=true
export DCI_CoreBranch=8.0.x
export DCI_Patch=2560643_26.patch,.
export JOB_URL=http://dispatcher-origin.drupalci.aws:8080/job/DCI_XML/
root@d8dc3dd9b155:/# which php
/opt/phpenv/shims/php
root@d8dc3dd9b155:/# more /opt/phpenv/shims/php
#!/usr/bin/env bash
set -e
[ -n "$RBENV_DEBUG" ] && set -x
program="${0##*/}"
if [ "$program" = "ruby" ]; then
for arg; do
#* Script to record and tag spotify tracks, by Lloyd Moore, modified by Ryan Aslett *)
#(* Make sure you are already recording in Audio Hijack Pro with a session called 'spotifySession' *)
tell application "Spotify"
set currentTrack to (current track)
set trackName to (name of currentTrack)
set trackNumber to (track number of currentTrack)
set trackAlbum to (album of currentTrack)
set discNumber to (disc number of currentTrack)
set albumArtist to (album artist of currentTrack)
@ryanaslett
ryanaslett / .htaccess bot stopper rules
Last active December 25, 2015 00:49
This is a snippet of code that prevents bots from POST'ing if they do not appear to behave like humans. It assumes that a human browser would download assets like javascript and css and sets a cookie when they do. If a cookie is not returned, POST is denied.
# If they are requesting resources, then they're probably not bots.
RewriteCond %{REQUEST_FILENAME} \.(gif|png|jpe?g|ico|swf|js|css)$ [NC]
RewriteRule .* - [L,co=dude:abides:%{HTTP:Host}:86400]
# Check if this is a post method,
# If so, the human cookie must be set.
# If the dudes dont abide, they get a 403 for their POST.
RewriteCond %{REQUEST_METHOD} =POST
RewriteCond %{REQUEST_URI} !.*trackback/?$ [NC]
RewriteCond %{REQUEST_URI} !=/index.php [NC]
@ryanaslett
ryanaslett / Fails
Created July 27, 2016 14:55
Fails in FieldUpdateTest with apc 4.0.11
176815|301|Drupal\field\Tests\Update\FieldUpdateTest|fail|GET http://localhost/checkout/update.php returned 0 (0 bytes).|Browser|Drupal\system\Tests\Update\UpdatePathTestBase->runUpdates()|243|/var/www/html/core/modules/system/src/Tests/Update/UpdatePathTestBase.php
176817|301|Drupal\field\Tests\Update\FieldUpdateTest|exception|simplexml_import_dom(): Invalid Nodetype to import<pre class="backtrace">simplexml_import_dom(Object) (Line: 133)
Drupal\simpletest\WebTestBase->parse() (Line: 226)
Drupal\simpletest\WebTestBase->xpath('//a[normalize-space()=:label]', Array) (Line: 2343)
Drupal\simpletest\WebTestBase->clickLinkHelper(Object, 0, '//a[normalize-space()=:label]') (Line: 2304)
Drupal\simpletest\WebTestBase->clickLink(Object) (Line: 244)
Drupal\system\Tests\Update\UpdatePathTestBase->runUpdates() (Line: 55)
Drupal\field\Tests\Update\FieldUpdateTest->testFieldUpdate8001() (Line: 1057)
Drupal\simpletest\TestBase->run(Array) (Line: 731)
simpletest_script_run_one_test('301', 'Drupal\field\Tests\Update\FieldUpda
@ryanaslett
ryanaslett / context modules
Last active August 10, 2016 04:27
Drupal project machine names that have at least one release with a dependency on context module
context_addassets
context_condition_theme
context_field
context_inline_editor
context_keywords
context_locale_cookie
context_menu_block
context_respect
context_ssl
debut_article
80.6279 https://dispatcher.drupalci.org/job/default/222731/console
81.0173 https://dispatcher.drupalci.org/job/default/223563/console
81.6139 https://dispatcher.drupalci.org/job/default/221748/console
82.0563 https://dispatcher.drupalci.org/job/default/223514/console
82.0609 https://dispatcher.drupalci.org/job/default/222099/console
82.0948 https://dispatcher.drupalci.org/job/default/222197/console
82.5083 https://dispatcher.drupalci.org/job/default/223132/console
82.9138 https://dispatcher.drupalci.org/job/default/222689/console
84.2821 https://dispatcher.drupalci.org/job/default/226748/console
84.7883 https://dispatcher.drupalci.org/job/default/226243/console
@ryanaslett
ryanaslett / gist:36e6d2ad8d5345cff81dc784d55d1bb4
Created December 1, 2016 23:08
This doesnt look promising. Looks like that file was only created a couple seconds earlier.
161201 22:18:30 >> log scanned up to (46434753699577)
161201 22:18:31 [10] Streaming ./mysql/gtid_slave_pos.ibd
161201 22:18:31 [08] Streaming ./mysql/innodb_table_stats.ibd
161201 22:18:31 [08] ...done
161201 22:18:31 [11] Streaming ./mysql/innodb_index_stats.ibd
161201 22:18:31 [14] Streaming ./events/actions.ibd
161201 22:18:31 [14] ...done
161201 22:18:31 >> log scanned up to (46434754429909)
161201 22:18:32 [08] Streaming ./events/advanced_help_index.ibd
161201 22:18:32 [08] ...done