Skip to content

Instantly share code, notes, and snippets.

View YetAnotherMinion's full-sized avatar

yam YetAnotherMinion

View GitHub Profile
class MyUserFunction : public apf::Function
{
public:
MyUserFunction(apf::Field* f, apf::Mesh* m) : node_field(f), mesh(m) {}
void eval(apf::MeshEntity* e, double *result) {
if(NULL != node_field) {
apf::MeshElement* me = apf::createMeshElement(this->mesh, e);
apf::Element* f_elm = apf::createElement(this->node_field, me);
{
this->field = createField(this->mesh, "dummy", apf::VECTOR, this->mesh->getShape());
apf::zeroField(this->field); /*must zero the field to force writing of data*/
this->D[0][0] = 1e1;
this->D[0][1] = 1e1;
this->D[1][0] = 1e1;
this->D[1][1] = 1e1;
this->D[2][2] = 1e1;
#include <stdio.h>
int main(int argc, char* argv[])
{
/*shape function gradient copied right out of manual*/
double a = -0.04364916731037106478741094406359479762613773345947265625;
double b = 1.3745966692414821608281272347085177898406982421875;
double c1 = 5.0;
double d = a*b;
double e = b*a;
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
FROM centos:centos7.2.1511
MAINTAINER YetAnotherMinion <yam@thinkalexandria.com>
ENV LIBEVHTP_DL_LOC="https://github.com/ellzey/libevhtp/archive/1.1.6.tar.gz"
ENV LIBZDB_DL_LOC="http://www.tildeslash.com/libzdb/dist/libzdb-2.12.tar.gz"
ENV POSTGRES_REPO="https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm"
RUN yum -y --nogpgcheck update
RUN yum -y --nogpgcheck install gcc-4.8.5-4.el7 \
@YetAnotherMinion
YetAnotherMinion / shake_elm_tree.py
Created May 6, 2017 15:58
Tree shaking POC for Elm
import os
import sys
import re
import string
expressions = []
# elm produces nice output where each complete top level expression starts with
# a line with zero indentation and continues up until the next line with zero
# indentation
@YetAnotherMinion
YetAnotherMinion / Client.elm
Created May 6, 2017 16:29 — forked from eriklott/Client.elm
Elm Backend Client
module YourAPIClient exposing (Config, otherFunctions)
import Http
import Json.Decode as Decode
import Json.Encode as Encode
-- Config
@YetAnotherMinion
YetAnotherMinion / IteratorBench.elm
Created June 10, 2017 15:45
Benchmark mapping over an Array and collecting into a List
module IteratorBench exposing (main)
import Benchmark exposing (Benchmark, benchmark2)
import Benchmark.Runner exposing (BenchmarkProgram, program)
import Time
import Html exposing (Html, div, text)
import Array exposing (Array)
main : BenchmarkProgram
main =
@YetAnotherMinion
YetAnotherMinion / main.rs
Last active June 18, 2017 16:35
Composite Foreign Key implementation attempt with Diesel
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_codegen;
table! {
table_a (tennant_id, part_number) {
tennant_id -> Int8,
part_number -> Int8,
@YetAnotherMinion
YetAnotherMinion / main.rs
Created July 1, 2017 17:49
single column foreign key with diesel 0.13.0
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_codegen;
table! {
// table_a (tennant_id, part_number) {
table_a (tennant_id) {
tennant_id -> Int8,
part_number -> Int8,