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
// Program to compare pthread locking v. x86 weakly ordered stores. | |
// | |
// One thread does writes protected by a lock, the main thread does | |
// reads protected by the lock and checks that it sees consistent | |
// values. | |
// Invoke with the command line parameter "normal" to use normal | |
// memory writes, or with the parameter "weak" to use SSE2 | |
// weakly-ordered memory writes. |
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
// On my Haswell 2.9GHz plus boost. | |
// With the atomic increment, the 2**29 iterations take just under 30 seconds. | |
// Without, about 11 seconds. | |
// | |
// I.e., the overhead for 0.5e9 atomic increments is approx 15 seconds, or | |
// 30nanosecs each. | |
// | |
// If we take the movntps operations out, the 2**29 atomic increments take | |
// approx 2.6 seconds, or 5ns each. |
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 <time.h> | |
#include <stdio.h> | |
#define CLOCK CLOCK_MONOTONIC_COARSE | |
int main() { | |
struct timespec t; | |
clock_getres(CLOCK, &t); | |
fprintf(stderr, "Res: %lu %06lu\n", t.tv_sec, t.tv_nsec); |
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
######################################################################## | |
# Using up-to-date meson to build for obsolete Debian as a cross-build. | |
######################################################################## | |
# | |
# This got me building C & C++ code for Debian Jessie using current | |
# meson & ninja on Fedora 31. | |
# | |
# 1. Install a Debian Jessie (or whatever) system image into a | |
# subdirectory using debootstrap e.g., | |
# sudo debootstrap jessie /opt/debian-8 |
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
// use std::fmt; | |
// use std::iter::Iterator; | |
use std::collections::BinaryHeap; | |
use std::cmp::Ordering; | |
const BITS : u32 = 50; | |
const MAX_PRIME : u32 = 1 << 25; | |
const MAX_NUM : u64 = 1 << 50; |
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
#!/usr/bin/python3 | |
import rpm | |
#from rpmUtils import miscutils | |
ts = rpm.TransactionSet('/') | |
def U(b): | |
return str(b) |
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
(global-set-key "\eg" 'goto-line) | |
(global-set-key "\C-x\\" 'save-buffers-kill-terminal) | |
(global-unset-key "\C-x\C-c") | |
(add-to-list 'load-path "/home/mirror/rust-mode/") | |
(autoload 'rust-mode "rust-mode" nil t) | |
;;(remove-hook 'write-file-functions 'makefile-warn-suspicious-lines) | |
(rassq-delete-all #'doc-view-mode auto-mode-alist) |
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
# .bashrc | |
# Source global definitions | |
#if [ -f /etc/bashrc ]; then | |
# . /etc/bashrc | |
#fi | |
# export SYSTEMD_PAGER= | |
# User specific aliases and functions |
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
// This is a 15 bit CRC used by the LTC6811. | |
// | |
// The CRC modulus polynomial is x¹⁵ + x¹⁴ + x¹⁰ + x⁸ + x⁷ + x⁴ + x³ + 1. | |
// | |
// I.e., 0xc599 or 0x4599 depending on whether you include the leading | |
// coefficient. | |
// | |
// Natural bit order is used (high bit of first byte has highest order; for SPI, | |
// first bit on the wire has highest order), both for the data and PEC. | |
// |