Skip to content

Instantly share code, notes, and snippets.

@jjgod
jjgod / 0001-Fix-CID-keyed-fonts-glyph-lookup.patch
Last active March 3, 2019 11:25
Patch to dvipdfm-x for CID-keyed font support
From 759df18a9c8ec05c6830687682c57d9e4c6a55d3 Mon Sep 17 00:00:00 2001
From: Jiang Jiang <[email protected]>
Date: Sat, 26 Jul 2014 21:33:19 +0200
Subject: [PATCH 1/3] Fix CID-keyed fonts glyph lookup
Keep cff_charsets parsed from CID font around if exists. Use the
cff_charsets to do GID -> CID lookup.
---
texk/dvipdfm-x/cff.c | 14 ++++++++------
texk/dvipdfm-x/cff.h | 1 +
@jjgod
jjgod / KeychainTest.c
Last active August 29, 2015 14:02
Build with `clang -framework CoreFoundation -Wall -framework Security KeychainTest.c -o kctest`
#include <sys/param.h>
#include <Security/Security.h>
static void displayName(const void *value, void *context)
{
SecKeychainRef keychain = (SecKeychainRef) value;
UInt32 pathLength = MAXPATHLEN;
char pathName[MAXPATHLEN + 1];
SecKeychainGetPath(keychain, &pathLength, pathName);
printf(" \"%*s\"\n", (int)pathLength, pathName);
@jjgod
jjgod / LionOrLater.cpp
Created May 19, 2014 10:06
Test whether a system is running 10.7 or later
#define MAC_OS_X_VERSION_10_7_HEX 0x00001070
static int sOnLionOrLater = -1;
static bool OnLionOrLater()
{
if (sOnLionOrLater < 0) {
SInt32 major = 0, minor = 0;
CFURLRef url =
In file included from /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Headers/OpenGL.h:10:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Headers/gl.h:2765:13: error: conflicting types for 'GLES2TexImage2D'
extern void glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
^
../../gpu/GLES2/gl2chromium_autogen.h:124:22: note: expanded from macro 'glTexImage2D'
#define glTexImage2D GLES2_GET_FUN(TexImage2D)
^
../../gpu/GLES2/gl2chromium.h:22:29: note: expanded from macro 'GLES2_GET_FUN'
#define GLES2_GET_FUN(name) GLES2 ## name
^
ASSERTION FAILED: !object->isSetNeedsLayoutForbidden()
../../third_party/WebKit/Source/core/rendering/RenderObject.cpp(671) : void WebCore::RenderObject::markContainingBlocksForLayout(bool, WebCore::RenderObject *, WebCore::SubtreeLayoutScope *)
1 0xd081c2d WebCore::RenderObject::markContainingBlocksForLayout(bool, WebCore::RenderObject*, WebCore::SubtreeLayoutScope*)
2 0xd15849a WebCore::RenderObject::setNeedsLayout(WebCore::MarkingBehavior, WebCore::SubtreeLayoutScope*)
3 0xcfed7c5 WebCore::RenderImage::repaintOrMarkForLayout(bool, WebCore::IntRect const*)
4 0xcfed4a0 WebCore::RenderImage::imageChanged(void*, WebCore::IntRect const*)
5 0xd093e8c WebCore::RenderObject::imageChanged(WebCore::ImageResource*, WebCore::IntRect const*)
6 0xc95a4db WebCore::ImageResource::notifyObservers(WebCore::IntRect const*)
7 0xc95b0ff WebCore::ImageResource::animationAdvanced(WebCore::Image const*)
8 0xc95b15f non-virtual thunk to WebCore::ImageResource::animationAdvanced(WebCore::Image const*)
@jjgod
jjgod / checkout-chromium-release-branches.markdown
Last active January 12, 2024 09:30
Steps to checkout Chromium release branches

Steps to checkout Chromium release branches

Initial setup

mkdir chromium && cd chromium
fetch --nohooks chromium --nosvn=True
gclient sync --with_branch_heads --nohooks # May not even need this.

Fetching/updating a specific release branch

/* Example code of using harfbuzz together with Core Text APIs. */
#include <hb-coretext.h>
int main(int argc, char* argv[]) {
if (argc != 3) {
fprintf(stderr, "usage: %s <PostScript-Name> <text>\n", argv[0]);
return 1;
}
@jjgod
jjgod / osx-video-decoding-efficiency.markdown
Last active August 29, 2015 13:57
CPU consumption numbers for current video players on OS X
@jjgod
jjgod / cldr-tool.patch
Created March 14, 2014 11:24
Patch to CLDR Java tool from unicode.org/cldr/
Index: org/unicode/cldr/icu/NewLdml2IcuConverter.java
===================================================================
--- org/unicode/cldr/icu/NewLdml2IcuConverter.java (revision 9961)
+++ org/unicode/cldr/icu/NewLdml2IcuConverter.java (working copy)
@@ -84,7 +84,8 @@
.add("filter", 'f', null, null, "Perform filtering on the locale data to be converted.")
.add("organization", 'o', ".*", null, "The organization to filter the data for")
.add("makefile", 'g', ".*", null, "If set, generates makefiles and alias files for the specified type. " +
- "The value to set should be the name of the makefile.");
+ "The value to set should be the name of the makefile.")
#!/usr/bin/env python
import os
import subprocess
import sys
# A minimal memoizing decorator. It'll blow up if the args aren't immutable,
# among other "problems".
class memoize(object):
def __init__(self, func):