Skip to content

Instantly share code, notes, and snippets.

View brettp's full-sized avatar

Brett Profitt brettp

View GitHub Profile
@brettp
brettp / lspci
Created February 19, 2017 15:50
lspci
00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA controller [AHCI mode] (rev 31)
00:1b.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Root Port #17 (rev f1)
00:1b.3 PCI bridge: Intel Corporation Sunrise Point-H PCI Root Port #20 (rev f1)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
00:1c.7 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #8 (rev f1)
@brettp
brettp / win10.xml
Created February 19, 2017 15:40
Win10 libvirt config
<domain type='kvm' id='1' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>Win10</name>
<uuid>4fd8244a-6bd8-4065-be0a-df53872e94ed</uuid>
<memory unit='KiB'>14680064</memory>
<currentMemory unit='KiB'>14680064</currentMemory>
<memoryBacking>
<hugepages/>
</memoryBacking>
<vcpu placement='static'>8</vcpu>
<cputune>
@brettp
brettp / thread-index.py
Last active November 26, 2021 10:39
Python implementation for Outlook's thread-index headers for message threading
import struct
import time
import sys
import base64
import hashlib
import datetime
def parse_thread_index(index: 'str') -> ("tuple (str, array [datetime.datetime, ...])"):
import binascii
@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.
*
switch (true) {
case whatever && whatever2:
doSomething();
break;
case whatever:
doSomethingElse();
break;
default:
doNothing();
break;
[brett@Bretts-Super-MacBook-Pro.local tmp]$ git clone https://github.com/Elgg/Elgg.git
Cloning into 'Elgg'...
remote: Reusing existing pack: 111652, done.
remote: Counting objects: 55, done.
remote: Compressing objects: 100% (52/52), done.
remote: Total 111707 (delta 19), reused 9 (delta 2)
Receiving objects: 100% (111707/111707), 31.02 MiB | 2.53 MiB/s, done.
Resolving deltas: 100% (70265/70265), done.
Checking connectivity... done.
@brettp
brettp / gist:1a80438d3e2c7c64f2fc
Created May 15, 2014 16:14
Tracking JS that Hughesnet inserts into the <head> of each page
<script type="text/javascript">
/* <![CDATA[ */
Math.random = function (a, c, d, b) {
return function () {
return 300 > d++ ? (a = (1103515245 * a + 12345) % b, a / b) : c()
}
}(1287608430, Math.random, 0, 1 << 21);
(function () {
function b() {
#!/bin/bash
LOG="/tmp/mail.log"
echo $argv >> ${LOG};
while read -r -a array; do
echo ${array[*]} >> ${LOG}
done
exit 0;
@brettp
brettp / android_stuff.md
Last active April 26, 2019 03:28
Copying the "SD card" contents between rooted Android devices that don't have a physical SD card using abd

Backup media partition

adb forward tcp:7080 tcp:8080
# from another terminal on same machine (or run adb cmd directly)
adb shell 'tar --exclude=/data/media/0/TWRP -Jcvf - /data/media | nc -p 8080 -l 1>/dev/null'

# original terminal
nc -w15 localhost 7080 &gt; media.tar.gz
@brettp
brettp / icon.php
Created May 1, 2012 05:11
groups icon without etags
<?php
/**
* Icon display
*
* @package ElggGroups
*/
require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
$group_guid = get_input('group_guid');