Skip to content

Instantly share code, notes, and snippets.

View unix-junkie's full-sized avatar

Andrey S. unix-junkie

  • Weyland-Yutani Corp.
  • Proxima Centauri
View GitHub Profile
@unix-junkie
unix-junkie / Font Antialiasing Test.html
Last active June 11, 2021 10:36
Grayscale vs subpixel font antialiasing
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Font Antialiasing Test</title>
</head>
<body alink="#000088" link="#0000FF" vlink="#FF0000">
<ul style="color: #000000; background: #ffffff;">
<li style="-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;">This text uses grayscale antialiasing</li>
<li style="-webkit-font-smoothing: subpixel-antialiased; -moz-osx-font-smoothing: auto;">This text uses subpixel antialiasing if available (i.e. if "LCD font smoothing" is enabled in <i>Mac OS X</i> preferences)</li>
@unix-junkie
unix-junkie / runme.clj
Created April 10, 2014 08:32
A Clojure one-liner which crashes the HostSpot JVM
(-> (doto (-> (->> (-> (Class/forName "sun.misc.Unsafe") .getDeclaredFields) (filter #(= (.getName %1) "theUnsafe"))) first) (.setAccessible true)) (.get nil) (.putAddress 0 0))
#include <stdio.h>
#include <Xm/Xm.h>
#include <Xm/MwmUtil.h>
#include <Xm/AtomMgr.h>
#include <Xm/PushB.h>
#include <Xm/Protocols.h>
Widget topLevel;
package com.example;
import static java.lang.Thread.currentThread;
import static java.lang.reflect.Proxy.newProxyInstance;
interface Duck {
void walk();
void quack();
#include <stdlib.h>
#include <wchar.h>
#include <Xm/XmAll.h>
void addLine(Widget parent,
char *keyWidgetName,
char *keyLabel,
char *valueWidgetName,
const XmString valueLabel);
@unix-junkie
unix-junkie / test-motif-xmstringcreate.c
Created May 13, 2016 17:38
Locale-specific XFontSet expansion
/*
* $Id$
*
* This test uses Monotype Arial font (<http://www.fonts.com/font/monotype/arial>,
* <https://en.wikipedia.org/wiki/Arial>).
*
* Availability:
* - Cygwin/X: out of the box (v 6.87, shipped with Windows);
* - Xsun: out of the box (shipped with Solaris);
* - X.Org on Debian Linux: either of the following packages:
@unix-junkie
unix-junkie / test-xcreatefontset.c
Created May 20, 2016 18:15
Incorrect XFontStruct entries in an XFontSet
/*
* $Id$
*/
#include <stdio.h>
#include <locale.h>
#include <langinfo.h>
#include <X11/Xlib.h>

Keybase proof

I hereby claim:

  • I am unix-junkie on github.
  • I am unix_junkie (https://keybase.io/unix_junkie) on keybase.
  • I have a public key whose fingerprint is A4EF CAAF 107E 7D25 EC1F F8E0 157D B07A 84EB 0C67

To claim this, I am signing this object:

package com.example;
import static java.lang.Thread.currentThread;
import static java.lang.Thread.interrupted;
import static java.lang.Thread.sleep;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@unix-junkie
unix-junkie / NullAnalysisTest.java
Created July 12, 2017 13:04
Why I think null analysis in Eclipse is better
package com.example;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class NullAnalysisTest {
void test0(final Object @Nullable[]@Nullable[] values) {
for (final Object[] line : values) { // XXX: values can be null (Eclipse: caught, IDEA: caught)
for (final Object item : line) { // XXX: line can be null (Eclipse: caught, IDEA: caught)
}