Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Korostoff MKorostoff

View GitHub Profile
View TodoRestResource.php
<?php
namespace Drupal\todo\Plugin\rest\resource;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\rest\Plugin\ResourceBase;
use Drupal\rest\ResourceResponse;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Psr\Log\LoggerInterface;
@MKorostoff
MKorostoff / deobfuscation.php
Created Jul 26, 2016
My attempt to de-obfuscate a PHP exploit file discovered on a hacked server.
View deobfuscation.php
<?php
/**
* First, we're going to establish an alphabet. We're never going to write code like:
*
* $foo = 'abc'
*
* Because it would be too easy to read. Instead, were' going to write code like:
*
* $alphabet = 'abcdefghijklmnopqrstuvwxyz';
View curl.php
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://YOUR_URL_HERE.COM");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
View gist:92f983593c782a45bd35
UID PID PPID C STIME TTY STAT TIME CMD
root 2 0 0 10:34 ? S 0:00 [kthreadd]
root 3 2 0 10:34 ? S 0:00 \_ [ksoftirqd/0]
root 4 2 0 10:34 ? S 0:00 \_ [kworker/0:0]
root 5 2 0 10:34 ? S< 0:00 \_ [kworker/0:0H]
root 6 2 0 10:34 ? S 0:00 \_ [kworker/u30:0]
root 7 2 0 10:34 ? S 0:00 \_ [rcu_sched]
root 8 2 0 10:34 ? S 0:00 \_ [rcuos/0]
root 9 2 0 10:34 ? R 0:00 \_ [rcuos/1]
root 10 2 0 10:34 ? S 0:00 \_ [rcuos/2]
View gist:cefdec3ea324cccfbc49
//Hide all schedule items by default
div.schedule-item {
display: none;
}
//After javascript has had a chance to act, reveal the schedule items
body.timezone-est div.schedule-item {
display: block;
}
View gist:976e0d00c0afa806fa83

#Main Menu main Every page here is a static menu callback, not a node. This menu cannot be changed by admin

  • Schedule /node
  • Watch /node
  • Medals Race /node
  • Results /node
  • Rio Feed /node
  • Team USA /node
  • Athletes /node
View gist:119261280da381402237
<?php
use Behat\Behat\Context\SnippetAcceptingContext;
use Drupal\DrupalExtension\Context\RawDrupalContext;
class LoadTimeContext extends RawDrupalContext implements SnippetAcceptingContext {
/**
* @Then /^time to first byte should be less than "([^"]*)" seconds$/
*/
public function timeToFirstByteShouldBeLessThanSeconds($max_seconds)
{
$session = $this->getSession();
View gist:8ee27d9cc517850a4e8e
<?php
/**
* @Given /^I send a request to google page speed for "([^"]*)" with "([^"]*)" strategy$/
*/
public function iSendARequestToGooglePageSpeedForWithStrategy($path, $strategy) {
if ($path === 'the homepage') {
$url = $this->getMinkParameter('base_url');
}
View gist:fb9f8c36a3ee9dff360c
<?php
function azure_demo_menu() {
$items = array();
$items['azure-demo'] = array(
'title' => 'Azure Demo',
'description' => 'Azure demo.',
'page callback' => 'drupal_get_form',
'page arguments' => array('azure_demo_form'),
View xdebug.ini
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
[xdebug]
xdebug.remote_enable=on
xdebug.default_enable=on
xdebug.remote_autostart=off
xdebug.remote_port=9000
xdebug.remote_host=localhost
;xdebug.profiler_enable_trigger=1
;xdebug.profiler_output_name=xdebug-profile-cachegrind.out-%H-%R
xdebug.var_display_max_children = 128
You can’t perform that action at this time.