Skip to content

Instantly share code, notes, and snippets.

View jonathan-beard's full-sized avatar
💭
available

Jonathan Beard jonathan-beard

💭
available
View GitHub Profile
@jonathan-beard
jonathan-beard / osx_nfs.md
Last active August 19, 2022 16:55
os_x_nfs

First, you'll need to decide where to setup the mount point. The most convenient place is within /System/Volumes/Data/Volumes/ given everything will just work if the directory is there. You don't need to create this directory yet since we'll make a script that'll automatically create it on boot. This path, let's say /System/Volumes/Data/Volumes/OurNFS is the mount point we use for the local ned of our NFS, we'll call this [path to local mountpoint] within the rest of the text.

@jonathan-beard
jonathan-beard / hh.hpp
Last active November 16, 2023 23:45
Constexpr highway hash for GNU++2a, works only on gcc.
/**
* hh.hpp - Highway Hash code that is constexpr compatible, this code
* is inspired by and derives significant amount of code from
* https://github.com/google/highwayhash to produce a compatible hash,
* that being said, it is an almost entirely different codebase at this
* point being far simpler (and less advanced than the original product),
* but it does produce a decent compile time hash function.
*
* @author: Jonathan Beard
* @version: Sun Feb 7 05:46:48 2019
template< class partition =
/**
* a bit hacky, yes, but enables you to inject
* the partitioner...if you'd like while keeping
* the default selection somewhat optimal (i.e.,
* enabling thread pinning if available by default)
*/
#ifdef __linux
#if USE_PARTITION
partition_scotch
raft::kernel a,b;
raft::map m;
m += a >> b;
m.exe();
#!/usr/bin/env perl
use strict;
my $hsuffix = "hpp";
my $csuffix = "cpp";
##
# assuming you have REALNAME as a shell var, nicely formatted username, etc.
##
my $author = $ENV{'REALNAME'};
#include <cstdio>
#include <iostream>
#include <cstdlib>
class foo
{
public:
foo()
{
++*this;
@jonathan-beard
jonathan-beard / hello_world.cpp
Last active May 10, 2016 23:56
RaftLib hello world. To build, set -std=c++11, link with raftlib library, and make sure you have boost installed.
#include <raft>
#include <raftio>
#include <cstdlib>
#include <string>
class hi : public raft::kernel
{
public:
hi() : raft::kernel()
{
@jonathan-beard
jonathan-beard / ql.sh
Created April 30, 2016 10:55
Quick hack to call OS X's quick look from the cmd line. Wanted to view files without having to go to the finder, and close them. Sometimes the cmd line isn't the best place to view Pages/Word docs so this is a good solution if you don't want to have to go back to the Finder and open the real app. Just download, chmod u+x ql.sh, place in your pag…
qlmanage -p $1 2> /dev/null > /dev/null
/** enable if type you want to re-use mult. times **/
template < class T > using OBJENABLE = typename std::enable_if<
std::is_object< T >::value && !
std::is_fundamental< T >::value >::type;
/** re-use multiple times **/
template < class T, OBJENABLE< T >* = nullptr /** if null don't instantiate **/ >
void do_it( const T &t )
{
int
main( int argc, char **argv )
{
const static auto chunksize( 65536 );
using chunk_t = raft::filechunk< chunksize >;
using fr_t = raft::filereader< chunk_t, false >;
using fw_t = filewrite< chunk_t >;
using comp = compress< chunk_t >;
/** variables to set below **/