Skip to content

Instantly share code, notes, and snippets.

View grayguest's full-sized avatar

XiaoMeng grayguest

  • 峰焕亭[FHT]、BlackArm[BA]、Hacker Not Cracker[HNC]
  • China
View GitHub Profile
@grayguest
grayguest / pproc.py
Created January 8, 2021 05:46 — forked from bbengfort/pproc.py
Runs multiple subprocesses in parallel, serializing stdout.
#!/usr/bin/env python3
# pproc
# Runs multiple subprocesses in parallel, serializing stdout.
#
# Author: Benjamin Bengfort <benjamin@bengfort.com>
# Created: Wed Jun 14 15:20:05 2017 -0400
#
# Copyright (C) 2017 Bengfort.com
# For license information, see LICENSE.txt
#
@grayguest
grayguest / xpath_escape.php
Created February 25, 2019 07:45 — forked from chrif/xpath_escape.php
Function to escape single and double quotes in XPath queries using PHP
<?php
function xpathEscape($query, $default_delim = '"')
{
if (strpos($query, $default_delim) === false)
return $default_delim . $query . $default_delim;
preg_match_all("#(?:('+)|[^']+)#", $query, $matches);
list($parts, $apos) = $matches;
foreach ($parts as $i => &$part) {
$delim = $apos[$i] ? '"' : "'";
$part = $delim . $part . $delim;