Skip to content

Instantly share code, notes, and snippets.

View wtneal's full-sized avatar

Weston Neal wtneal

  • Arizona
View GitHub Profile
@wtneal
wtneal / dd_integration.md
Last active July 31, 2019 20:37
DataDivers Integration HTTP Post

Option 1: HTTP Request

This might work using the built in HTTP Request functionality. The main concern is that the body XML string needs to be url encoded for this to work properly. Does this happen automatically or does this need to be done with another call or manually?

I don't know if this functionality is available to all versions or what version you may be running.

C_TEXT($response)
// build the form inside the body, e.g. `field1=value1&field2=value2`
$body_t:="query=...rest of xml goes here"
@wtneal
wtneal / async_scraper.py
Last active April 17, 2019 07:38
asyncio scraper
import asyncio
import aiofiles
import aiohttp
import logging
import re
import sys
import os
import lxml.html
@wtneal
wtneal / New error output
Created April 3, 2015 16:07
New error output
vagrant@vagrant-ubuntu-trusty-64:/vagrant/text-geolocator$ sudo fig run web nosetests geolocator/app/tests/*
.......................F..............F..................E....
======================================================================
ERROR: Tests app.weighter.LocationAdminNames.__repr__
----------------------------------------------------------------------
Traceback (most recent call last):
File "/code/geolocator/app/tests/test_weighter.py", line 104, in test__repr__good
s = self.codes.__repr__()
AttributeError: 'LocationAdminNamesTestCase' object has no attribute 'codes'
@wtneal
wtneal / gist:1fd30fd1f0f9b89c9414
Created March 23, 2015 19:23
App test errors
Ensures that the app.geolocator.LocationHits successfully initializes ... ok
Tests :func:`app.geolocator.LocationHits.increment_weight_on_match` ... ok
Ensures that the app.geolocator.LocationHits successfully initializes ... ok
Tests :func:`app.geolocator.LocationHits.__iter__` ... ok
Tests :func:`app.geolocator.LocationHits.__len__` ... ok
Tests :func:`app.geolocator.LocationHits.next` ... ok
Tests :func:`app.geolocator.LocationHits.__repr__` ... ok
Tests the "getter" functions for the locationwrapper ... ok
Ensures that the LocationWrap successfully initializes ... ok
Tests preprocesstext function as well as tokenize and removepunctuation ... ok
#include <sys/shm.h>
#include <sys/wait.h>
#include <malloc.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <error.h>
#include <math.h>
/*
/* Set the chunk size (amount of work for each process */
chunk = dim / sqrt(num_proc);
/* Get the process id */
rank = getpid() - base_pid;
/* Calculate the offsets for the result matrix */
offset_row = (rank % (dim / chunk)) * chunk;
offset_col = floor((rank * chunk) / dim) * chunk;