Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am xorgy on github.
  • I am xorgy (https://keybase.io/xorgy) on keybase.
  • I have a public key whose fingerprint is FD9A DF7E AEAE C264 10C3 C209 A8F2 074E BB35 9173

To claim this, I am signing this object:

(ns je.suis.un-petit-index
(:require [clojure.set :refer [intersection]]))
(defn- normalize-nfd [^String s]
(java.text.Normalizer/normalize s java.text.Normalizer$Form/NFD))
(defn- two-gram [cs]
(persistent!
(loop [acc (transient [])
[head & cs] cs]
@xorgy
xorgy / 0-before.fods
Last active May 19, 2020 13:40
Oh lord
<?xml version="1.0" encoding="UTF-8"?>
<office:document
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
xmlns:ooo="http://openoffice.org/2004/office"
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
office:version="1.2"
office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
@xorgy
xorgy / bulb.svg
Created September 19, 2019 23:48
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xorgy
xorgy / swaylock-strace.txt
Created August 20, 2019 21:39
When swaylock exits without error because the wl_display is not present.
[aaron@aka ~]$ strace swaylock
execve("/usr/bin/swaylock", ["swaylock"], 0x7ffc9302f7a0 /* 61 vars */) = 0
brk(NULL) = 0x563df7e80000
arch_prctl(0x3001 /* ARCH_??? */, 0x7fffe16c8700) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=469694, ...}) = 0
mmap(NULL, 469694, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa30260d000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libcairo.so.2", O_RDONLY|O_CLOEXEC) = 3
// R-type ops
static const uint32_t OpRMask = 0b11111110000000000111000001111111;
enum OpR : uint32_t {
// RV32I
OR = 0b110000000110011,
ADD = 0b000000000110011,
};
// I-type ops
static const uint32_t OpIMask = 0b111000001111111;
void TurboAssembler::li_smallest(Register rd, int64_t j) {
BlockTrampolinePoolScope block_trampoline_pool(this);
unsigned trailing = CountTrailingZeros(j);
unsigned leading = CountLeadingZeros(j);
unsigned solid = 64 - trailing - leading;
if (solid <= 12) {
if (leading >= 44) {
emit(ORI, rd, zero_reg, j);
} else if (leading >= 32 && trailing >= 12) {
emit(LUI, rd, j >> 44);
// Copyright 2018 Aaron Muir Hamilton
//
// Permission to use, copy, modify, and/or distribute this software for
// any purpose with or without fee is hereby granted, provided that the
// above copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#define BUFSIZE (1023 * 1024 * 4)
#define HISTSIZE (0x7f - ' ')
typedef struct hist_entry_s {
uint64_t count;
char codepoint;
@xorgy
xorgy / comeonman.js
Last active January 13, 2017 01:35 — forked from CatTail/htmlentity.js
Javascript: encode(decode) html text into html entity
// encode(decode) html text into html entity
function decodeHtmlEntity(str) {
return str.replace(/&#(\d+);/g, function(match, dec) {
return String.fromCharCode(dec);
});
};
function encodeHtmlEntity(str) {
var buf = '';
for (var i = 0; i < str.length; i++) {