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
#ifndef DLL_LOADER_HPP | |
#include "windows.h" | |
#include <string> | |
#include <stdexcept> | |
#include <type_traits> | |
#include <utility> | |
// what! |
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
cl /Wall /WX /Za /Zc:strictStrings,trigraphs /EHsc /volatile:iso /Feblah.exe |
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 "dll_loader.hpp" | |
#include <iostream> | |
#include <vector> | |
#include <utility> | |
struct model { | |
double qi; | |
double Di; | |
double bi; |
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
kill.adobe <- function(filename) | |
{ | |
old.warn <- options(warn=-1) | |
filter <- paste('/NH /FI "WINDOWTITLE eq ', filename, ' - Adobe Reader"', sep="") | |
res <- shell(paste("tasklist ", filter, ' | sed -e "s/ \\+/:/g" | cut -d ":" -f 2 | grep . | sed -e "s/^/\\/pid /g" | xargs taskkill', sep=""), | |
mustWork=NA, intern=TRUE) | |
options(old.warn) | |
grepl("SUCCESS", res[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
thereis <- function(x) exists(deparse(substitute(x)), parent.frame()) |
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 "anynum.hpp" | |
#include <iostream> | |
int main() | |
{ | |
any_number a = 5, b = 6.7, c = b * 3.2, d = a / a; | |
std::cout << a << ", " << b << ", " << c << ", " << d << '\n'; | |
std::cout << a.underlying_type().name() << ", " | |
<< b.underlying_type().name() << ", " << c.underlying_type().name() | |
<< ", " << d.underlying_type().name() << '\n'; |
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 <iostream> | |
#include <memory> | |
#include <new> | |
#include <vector> | |
#include <cstddef> | |
#include <cstdlib> | |
struct wacky_tag_t {} wacky_tag; | |
void* operator new(std::size_t n) |
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
from sys import argv, stderr, stdout, exit | |
def main(args): | |
fname = args[1] | |
stdout.write('UID\tName\tAPI\tLatitude\tLongitude\tMonth\tOil\tGas\tWater\tWells\n') | |
with open(fname) as f: | |
for w in well_production(f): | |
n_records = len(w['Month']) | |
for i in range(n_records): | |
stdout.write('\t'.join((w['UID'], w['Name'], w['API'], |
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
select | |
t.UWI, | |
t.Formation, | |
t.Top, | |
t.NextTop as Base, | |
p.StartDepth, | |
p.EndDepth | |
from Perfs p | |
inner join VerticalTops t | |
on p.UWI = t.UWI |
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
select * from | |
( | |
select MIN(x.ProdDate) as FirstProdDate, (SUM(x.OilVol) - MAX(x.OilVol) - MIN(x.OilVol)) As MedianOilVol | |
from ( | |
select | |
ProdDate, | |
OilVol, | |
ROW_NUMBER() over (order by ProdDate) as RowNum |