Skip to content

Instantly share code, notes, and snippets.

Aaron Muir Hamilton xorgy

Block or report user

Report or block xorgy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bulb.svg
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 Aug 20, 2019
When swaylock exits without error because the wl_display is not present.
View swaylock-strace.txt
[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
View didsomebodysaypolymorphism.cc
// 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;
View li_smallest.cc
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);
View constants-riscv.h
// 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
View ascii-histogram.c
#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 Jan 13, 2017 — forked from CatTail/htmlentity.js
Javascript: encode(decode) html text into html entity
View comeonman.js
// 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++) {
View spherical.js
function xyz_to_ρ (x, y, z) {
return Math.sqrt((x * x) + (y * y) + (z * z));
}
function zρ_to_θ (z, ρ) {
return Math.acos(z / ρ);
}
function yx_to_φ (y, x) {
return Math.atan(y / x);
View chart.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View openbenchmarking.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.