Skip to content

Instantly share code, notes, and snippets.

View ZsBT's full-sized avatar
💭
💙 💛

ZS ZsBT

💭
💙 💛
View GitHub Profile
@brettp
brettp / thread-index.php
Created August 21, 2015 22:35
PHP implementation for Outlook's bogus proprietary thread-index for message threading
<?php
/*
* Generates strings appropriate to use as values for Microsoft's annoying Thread-Index email header.
* This is how Outlook groups email threads in conversation view.
*
* These headers are base64 encoded 22-byte binary strings in the format:
* 6 bytes: The first 6 significant bytes from a FILETIME timestamp.
* 16 bytes: A unique GUID in hex.
*
@vi
vi / cgroup_memory_pressure_monitor.c
Created July 19, 2015 22:51
Simple command-line tool use cgroup's memory.pressure_level
#include <sys/eventfd.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
// Implemented by Vitaly "_Vi" Shukela in 2015, License=MIT.
@supermethod
supermethod / gist:913394
Created April 11, 2011 11:53
Convert a PHP array into XML file using SimpleXML
class ArrayToXML
{
/**
* The main function for converting to an XML document.
* Pass in a multi dimensional array and this recrusively loops through and builds up an XML document.
* Based on: http://snipplr.com/view/3491/convert-php-array-to-xml-or-simple-xml-object-if-you-wish/
*
* @param array $data
* @param string $rootNodeName - what you want the root node to be - defaultsto data.
* @param SimpleXMLElement $xml - should only be used recursively