This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unaligned.h | |
// Safely access unaligned multi-byte values (e.g on ARM) | |
// Jonathon Reinhart | |
// The use of 'packed' forces the compiler to assume no better | |
// than 1-byte alignment, and issue sequential byte reads/writes. | |
typedef union __attribte__((packed)) { | |
int16_t int16; | |
uint16_t uint16; | |
int32_t int32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I had to also do the following items to play nicely with SELinux: | |
Restore the proper SELinux labels on smb.conf and my smbusers: | |
# chcon system_u:object_r:samba_etc_t:s0 smb.conf | |
# chcon system_u:object_r:samba_etc_t:s0 smbusers | |
Allow Samba to access home dirs: | |
# setsebool -P samba_enable_home_dirs 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Type=Application | |
Encoding=UTF-8 | |
Name=Zotero | |
Exec=/opt/zotero/run-zotero.sh | |
Icon=/opt/zotero/icons/zotero-new-z-48px.png | |
Terminal=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
typedef size_t foo_h; | |
typedef size_t bar_h; | |
void foo(foo_h h) { (void)h; } | |
void bar(bar_h h) { (void)h; } | |
int main(void) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#define __packed __attribute__((packed)) | |
/* https://commons.wikimedia.org/wiki/File:Table_of_x86_Registers_svg.svg */ | |
#define REGDEF_hl(Z) \ | |
union __packed { \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stddef.h> | |
void *malloc_safe(size_t n) | |
{ | |
void *p = malloc(n); | |
if (!p) { | |
fprintf(stderr, "malloc(%zd) failed\n", n); | |
abort(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Derived from http://stackoverflow.com/a/7776146/119527 | |
void fhexdump(FILE *f, const void *addr, size_t len, const char *addrfmt, size_t baseaddr) | |
{ | |
size_t i; | |
unsigned char buff[17]; | |
const unsigned char *pc = addr; | |
// Process every byte in the data. | |
for (i = 0; i < len; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This prevents docker config from persisting to disk. | |
# Place this file in /etc/profile.d/ to happen automatically at login for all users. | |
# JRR 2015-12-17 | |
# See: | |
# https://github.com/docker/docker/issues/10318 | |
# https://github.com/docker/docker/issues/18708 | |
dockercfgdir="/dev/shm/dockercfg-$(id -un)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
email = jonathon.reinhart@gmail.com | |
name = Jonathon Reinhart | |
[color] | |
ui = true | |
[core] | |
# I can exclude my own editor's files; no need to include in project .gitignore | |
excludesfile = ~/.gitignore_global | |
editor = vim | |
[push] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env = Environment( | |
CCFLAGS = ['-Wall', '-Werror'], | |
) | |
env.Program('mkdir_p_test', ['mkdir_p.c', 'test.c']) |
OlderNewer