Skip to content

Instantly share code, notes, and snippets.

View apaprocki's full-sized avatar

Andrew Paprocki apaprocki

  • Bloomberg L.P.
  • New York, NY
View GitHub Profile
@apaprocki
apaprocki / gist:2dc1041c8e88a293890750dca4181c91
Created March 23, 2017 19:33
_LIBCPP preprocessor defines
#define _LIBCPP_ABI_VERSION 1
#define _LIBCPP_ALGORITHM
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#define _LIBCPP_ASSERT(x,m) ((void)0)
#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR __attribute__((availability(macosx,strict,introduced=10.9))) __attribute__((availability
(ios,strict,introduced=7.0)))
#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
@apaprocki
apaprocki / bslmf_typelist.h
Created November 7, 2014 23:03
Possible variadic template bslmf::TypeList implementation
#if defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES)
// =========================
// struct TypeListImp_TypeOf
// =========================
template <typename T>
struct TypeListImp_TypeOfId {
using Type = T;
using TypeOrDefault = T;

Keybase proof

I hereby claim:

  • I am apaprocki on github.
  • I am ap (https://keybase.io/ap) on keybase.
  • I have a public key whose fingerprint is 9754 D90A 5340 07D3 D33B 6706 1A71 299D 4E01 16D5

To claim this, I am signing this object:

@apaprocki
apaprocki / splashr.ino
Created December 11, 2013 01:52
Splashr -- RobotsConf 2013 Hack
const int ledPin = D1;
const int waterSensor = A0;
int wetStatus = 0;
int lastWetStatus = 0;
int waterAvg = 0;
int smsActive = 0;
// Endpoint must deliver SMS message when root HTTP request is received.
// Real implementation would have to somehow retrieve a token so that
@apaprocki
apaprocki / blpapi.js
Last active December 23, 2015 01:49
Mockup of module API that returns a handle which is then used to read partial responses as promises in a generator function.
exports.Session.prototype.request =
function(uri, name, request, label) {
var current = Q.defer();
var handle = {
// When 'current' is set to 'undefined', it indicates that there are
// no more responses and 'readResponse' should return 'undefined'.
readResponse: function(cb) {
return current ? current.promise : Q(undefined);
}
};
@apaprocki
apaprocki / issue5564.cc
Last active December 17, 2015 20:59
Using libuv to create a loop which uses `UV_RUN_ONCE` to handle either a single timer firing or async send. If the timeout for the timer is 0ms, only one `UV_RUN_ONCE` is needed, but if the timeout is > 0ms, a second `UV_RUN_ONCE` call is needed or the timer callback does not fire.
// Compiling from toplevel of built node.js repo on OSX:
// CC -g -o issue5564 issue5564.cc -I deps/uv/include/ \
// -L out/Debug/ -luv -framework CoreFoundation -framework Carbon
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "uv.h"
@apaprocki
apaprocki / passage-sur-le-disque-solaire-english
Created November 23, 2012 15:06
PASSAGE SUR LE DISQUE SOLAIRE
PASSING ON THE SOLAR DISC
A SWARM OF AL CORPUSCLES VU OBSERVATORY ZACATECAS MEXICO
J was established in Zacatecas Observatory located at 2502m above sea nivea u the daily observation of the state of the solar surface by drawing direct spray spots and faculae granules and protuberances of the solar chromosphere by means of the spectroscope.
For this purpose the j fits equatorial 0m lti opening of a projection apparatus which receives a sheet of paper an image of the sun 250 in diameter 0m the field of the telescope is projecting itself on a surface of unenlightened 0m 260 When the solar disc offers some interest I take photographs of 067 0m diameter plates do with the instant gélatinobromure of money.
The dome of the Observatory has small windows and thick black curtains so that it penetrates the objective that only the Sun imago This arrangement allows always note with precision and clarity faculae and spots every detail and granulations with the transparency of the atmosphere at the altitude at which the
@apaprocki
apaprocki / passage-sur-le-disque-solaire-french
Created November 23, 2012 15:04
PASSAGE SUR LE DISQUE SOLAIRE
PASSAGE SUR LE DISQUE SOLAIRE
D UN ESSAIM DE CORPUSCULES VU A L OBSERVATOIRE DE ZACATECAS MEXIQUE
J ai institué à l Observatoire de Zacatecas situé à 2502m au dessus du nivea u de la mer l observation quotidienne de l état de la surface solaire en dessinant par voie directe et par projection les taches facules et granulations ainsi que les protubérances de la chromosphère solaire au moyen du spectroscope.
A cet effet j adapte à l équatorial de 0m lti d ouverture un appareil de projection qui reçoit sur une feuille de papier une image du Soleil de 0m 250 de diamètre le champ de la lunette ne se projetant lui même que sur une surface peu éclairée de 0m 260 Lorsque le disque solaire offre un certain intérêt je prends des photographies de 0m 067 de diamètre au moyen do plaques instantanées au gélatinobromure d argent.
La coupole de l Observatoire a de petites fenêtres et d épais rideaux noirs de sorte qu il ne pénètre à travers l objectif que l imago seule du Soleil Cette disposition permet de noter toujours
@apaprocki
apaprocki / v8_terminateexception_with_trycatch.cc
Created October 12, 2012 15:17
V8::TerminateException with TryCatch
#include <pthread.h>
#include <unistd.h>
#include <iostream>
#include <v8.h>
using namespace v8;
static void *run(void *ptr) {