Skip to content

Instantly share code, notes, and snippets.

@gidden
gidden / Hello World
Created September 20, 2013 18:11
Hello World
/// @brief a first-time gist for a first-time gister.
/// prints Hello World! to std out.
#include <iostream>
int main() {
std::cout << "Hello World!" << std::endl;
}
@gidden
gidden / gist:7161374
Last active December 26, 2015 13:49
no container of pointers to objects in other containers
struct request {
string commod;
double pref;
}
class context {
public:
// adding this in the constructor will fix it until resizing occurs
// context() {
// int reserve_size = 16 // a magic number
@gidden
gidden / dict.items
Created October 26, 2013 20:41
using dict.items
def test_abundance_by_z_for_soundness():
for k, vs in data.abundance_by_z.items():
if vs:
assert(abs(1-sum([v[1] for v in vs]))<1e-12)
/// @brief execute the full resource sequence
void Execute() {
// collect resource exchange information
ResourceExchange<T> exchng(ctx_);
exchng.AddAllRequests();
exchng.AddAllBids();
exchng.DoAllAdjustments();
// translate graph
ExchangeTranslator<T> xlator(&exchng.ex_ctx());
TEST(ExManagerTests, NullTest) {
TestContext tc;
GreedySolver solver;
ExchangeManager<Material> manager(tc.get(), &solver);
EXPECT_NO_THROW(manager.Execute());
}
@gidden
gidden / NBases, same member
Created January 16, 2014 04:25
reference member from multiple base classes
#include <iostream>
class Base1 {
public:
int index;
Base1() : index(1) {};
};
class Base2 {
public:
@gidden
gidden / gist:10910786
Created April 16, 2014 17:29
double free from xdressed pair of custom type
** Error in `/usr/bin/python': double free or corruption (fasttop): 0x00000000018a60e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80996)[0x7ffff7875996]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSsD1Ev+0x1f)[0x7ffff0e8405f]
/home/gidden/work/xdress/tests/cppproj/install-gccxml/lib/python2.7/site-packages/cppproj/pybasics.so(_ZN7cppproj18SomeCrazyPairValueD1Ev+0x18)[0x7fffef57807e]
/home/gidden/work/xdress/tests/cppproj/install-gccxml/lib/python2.7/site-packages/cppproj/pybasics.so(_ZNSt4pairIiN7cppproj18SomeCrazyPairValueEED1Ev+0x1c)[0x7fffef57809c]
/home/gidden/work/xdress/tests/cppproj/install-gccxml/lib/python2.7/site-packages/cppproj/pybasics.so(_ZN7cppproj7TClass2IfED1Ev+0x2d)[0x7fffef579265]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c071)[0x7ffff7831071]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c0f5)[0x7ffff78310f5]
/usr/bin/python[0x4189b9]
@gidden
gidden / gist:11049508
Created April 18, 2014 15:19
condor interactive submit
# This is a "normal" job.
universe = vanilla
# If any information about this submission is written
# as output to standard output or standard error,
# where should it be saved?
output = process.out
error = process.err
# Where to write a log of your jobs' statuses.
@gidden
gidden / gist:54ca4f9f41a4060ebec9
Created June 13, 2014 17:13
pytables failure on void col dtype
import numpy as np
import tables as t
import uuid
id = uuid.uuid4()
h5file = t.open_file(".tmp{0}".format(id), mode='w',)
dtype = np.dtype([('id', (np.void, 16))])
h5file.create_table(h5file.root, "hi", dtype)
@gidden
gidden / gist:048aa75995abe6d82e8b
Created July 10, 2014 16:32
Cyclopts Output for 8200a48be1384daaa150177f1a57fbc9
UUID with max number of arc: 8200a48be1384daaa150177f1a57fbc9 (189540 arcs)
Coin0506I Presolve 10664 (-10486) rows, 104064 (-85566) columns and 301482 (-455148) elements
Clp0006I 0 Obj 0 Primal inf 5459.3801 (90)
Clp0006I 278 Obj 3546.3574 Primal inf 1115.8705 (395)
Clp0006I 556 Obj 3547.8921 Primal inf 639.72194 (242)
Clp0006I 834 Obj 3549.2624 Primal inf 122.41827 (63)
Clp0006I 888 Obj 3549.3124
Clp0000I Optimal - objective value 3549.3124
Coin0511I After Postsolve, objective 3549.3124, infeasibilities - dual 1.1480397 (155), primal 0 (0)