Skip to content

Instantly share code, notes, and snippets.

View kostajh's full-sized avatar

Kosta Harlan kostajh

View GitHub Profile
#!/bin/bash
# /etc/init.d/xvfb_daemon
# Xvfb startup script.
# Tom Meier <tom@venombytes.com>
#
### BEGIN INIT INFO
# Provides: xvfb
# Short-Description: Start/stop/restart daemon
# Description: Controls the Xvfb daemon which starts/stops the X Virtual Framebuffer server
# Example Use:
@noqqe
noqqe / mutt2task.py
Last active December 23, 2015 01:48
I was running into some encoding errors with internationalized mailheaders in the traditional mutt2task. So this is a improved, more reliable, charset- and limiter-save version of mutt2task from http://www.nixternal.com/mark-e-mails-in-mutt-as-tasks-in-taskwarrior/ written in Python.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## About
# Add the subject of a mail as task to taskwarrior
#
## Usage
# add this to your .muttrc:
# macro index,pager t "<pipe-message>~/path/to/mutt2task.py<enter>"
@hawkeyetwolf
hawkeyetwolf / drush-alias-remote-host-check.php
Last active April 4, 2016 22:16
Drush aliases: scrub "remote host" key for cross-environment use
<?php
/**
* @file
* Example drush alias file for multihost use.
*/
// Alias settings common to all.
$aliases['base'] = array(
'root' => '/var/www/docroot',
@mikeyp
mikeyp / search.sh
Last active September 16, 2016 16:07
BOOM
ag "$@" | peco | awk -F ':' '{print $1 ":" $2}' | xargs pstorm
<?php
/**
* @file
* Implements a Solr proxy.
*
* Currently requires json_decode which is bundled with PHP >= 5.2.0.
*
* You must download the SolrPhpClient and store it in the same directory as this file.
*
<?php
class DrupalHubFlagLike extends \RestfulEntityBase {
/**
* {@inheritdoc}
*/
public function publicFieldsInfo() {
$public_fields = parent::publicFieldsInfo();
function THEMENAME_theme_suggestions_block_alter(array &$suggestions, array $variables) {
if (isset($variables['elements']['content']['#block_content'])) {
$suggestions[] = 'block__' . $variables['elements']['content']['#block_content']->bundle();
}
}
@black-silence
black-silence / sonarphp-xml-patcher.py
Created April 10, 2019 13:49
quick-dirty phpunit xml result patcher so sonarphp doesn't choke
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
et = ET.parse('logfile.xml')
root = et.getroot()
for mastersuites in root:
for suite in mastersuites:
if not "file" in suite.attrib:
continue
@egardner
egardner / Dockerfile
Last active January 28, 2021 17:39
Basic MW dev environment with Docker
# Put this in web/Dockerfile
# Adapted from https://github.com/wikimedia/mediawiki-docker/blob/master/1.32/Dockerfile
FROM php:7.2-apache
# System Dependencies.
RUN apt-get update && apt-get install -y \
git \
imagemagick \
libicu-dev \
@jhedstrom
jhedstrom / FeatureContext.php
Last active June 24, 2021 12:55
Using the Behat Drupal Extension on sites with basic auth
<?php
/**
* Run before every scenario.
*
* @BeforeScenario
*/
public function beforeScenario() {
if ($basic_auth = $this->getDrupalParameter('basic_auth')) {
$driver = $this->getSession()->getDriver();
if ($driver instanceof Selenium2Driver) {