Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
#
# Classify homebrew formulas by origins
def repo f
STDERR.print '.'
`brew info #{f}`.split("\n").map(&:chomp).each do |s|
if s =~ /^From: (.*)/
return $1.gsub(/^https:\/\/github.com\/(.*)\/blob\/.*/, '\1')
end
@theirix
theirix / pstack-osx.sh
Created April 7, 2015 08:39
pstack for osx
#!/bin/sh
#
# Script prints gdb stack of the process with a specified pid
if [ -z $1 ]; then
echo "Usage: $0 pid"
exit 1
fi
PID=$1
@theirix
theirix / 0001-Fixed-build-and-runtime-tidy-errors.patch
Created April 25, 2015 10:13
0001-Fixed-build-and-runtime-tidy-errors.patch
From 2aad6eb0337498fff3e411f514539218d686b8e5 Mon Sep 17 00:00:00 2001
From: theirix <theirix@gmail.com>
Date: Sat, 25 Apr 2015 13:01:47 +0300
Subject: [PATCH] Fixed build and runtime tidy errors
1. Replaced explicit TidyBuffer init with proper function call.
This prevents known error https://cl.ly/WwyM
2. Fixed runtime issue with Init/Bool tidy parameter
Tested with tidy 20090325 on OS X (debian uses 20091223).
---
From a4e8b94c553940d1a741895a3e6a54deb1f03085 Mon Sep 17 00:00:00 2001
From: theirix <theirix@gmail.com>
Date: Sun, 3 May 2015 19:05:41 +0300
Subject: [PATCH] Autodetect correct TidyBodyOnly parameter type
Autodetect which version (Int or Bool) should be used.
TidyBodyOnly has different types in different versions
(tidy 20061031 on OS X and 20091223 on debian).
---
src/util.cpp | 22 +++++++++++++++++++++-
digraph test {
compound = true;
remincross = true;
subgraph cluster_g{
"node_g" [shape=point style=invis];
G;
};
subgraph cluster_h{
@theirix
theirix / gitcleanup.sh
Created March 3, 2016 17:10
Clean a git working copy
#!/bin/bash
if [ -d "$1" ] ; then
cd "$1"
fi
git gc -q
git repack -q -a -d --depth=250 --window=250
git prune
@theirix
theirix / foo.cpp
Created July 26, 2016 10:53
Libasan failure on devtoolset-3
// test with:
// scl enable devtoolset-3 -- g++ -std=c++11 -g -O0 -fsanitize=address -static-libasan foo.cpp
#pragma pack(1)
struct TestStruct
{
};
#include <regex>
@theirix
theirix / FixedGZIPInputStream.java
Created August 15, 2016 16:21
GZIPInputStream for Android without 2 GiB limitation
import android.support.annotation.NonNull;
import java.io.FilterInputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
/**
* GZIPInputStream that works correctly with files more than 2 GiB
* <p/>
* <p><b>Rationale</b>
@theirix
theirix / test.log
Created August 27, 2016 14:43
xelatex failure log
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016/Debian) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2016/03/31> patch level 3
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/unicode-math/unicode-math.sty
@theirix
theirix / test.tex
Created August 27, 2016 14:45
xelatex failure MWE
\documentclass{article}
% this:
\usepackage{unicode-math}
\usepackage[english]{babel}
\begin{document}
\title{Test}
\author{Foo}