Skip to content

Instantly share code, notes, and snippets.

View hanumantmk's full-sized avatar

Jason Carey hanumantmk

  • MongoDB
  • New York City
View GitHub Profile
@hanumantmk
hanumantmk / repo_prune.pl
Created July 20, 2017 02:07
Example creating a git repo with a long lived feature branch and pruning a set of changes out
#!/usr/bin/perl
use strict;
use warnings;
system("rm -rf repo");
mkdir "repo";
chdir "repo";
@hanumantmk
hanumantmk / nullptr.md
Last active August 29, 2015 14:10
nullptr_t
@hanumantmk
hanumantmk / observer.c
Created September 24, 2014 15:44
some ideas for an observer api
typedef struct mongoc_client_observer {
void (* bind)(void * user_data, const mongoc_socket_t*);
void (* command)(void * user_data, const char* ns, const bson_t* command);
void (* padding[10])(void);
} mongoc_client_observer_t;
typedef void (* mongoc_client_observer_data_dtor_t)(void *);
void
mongoc_client_attach_observer (const mongoc_client_observer_t *observer,
@hanumantmk
hanumantmk / dataviewexample.cpp
Created September 2, 2014 14:50
dataview example
#include "mongo"/base/data_view.h"
class OpTime {
public:
OpTime(uint32_t increment, uint32_t timestamp) {
setIncrement(increment);
setTimestamp(timestamp);
}
void setIncrement(uint32_t v) {
@hanumantmk
hanumantmk / macro.c
Created August 14, 2014 22:19
macro magic
#define zend_hash_update_helper(ht, arKey, nKeyLength, pData, nDataSize, pDest) \
_zend_hash_add_or_update(ht, arKey, nKeyLength, pData, nDataSize, pDest, HASH_UPDATE ZEND_FILE_LINE_CC)
#define zend_hash_update(...) \
zend_hash_update_helper(__VA_ARGS__)
#define ZEND_STRS(str) (str), (sizeof(str))
zend_hash_update(HASH_OF(zquery), "$orderby", sizeof("$orderby"), (void *) data, sizeof(zval *), NULL);
@hanumantmk
hanumantmk / keybase.md
Created June 4, 2014 15:45
keybase.io

Keybase proof

I hereby claim:

  • I am hanumantmk on github.
  • I am hanumantmk (https://keybase.io/hanumantmk) on keybase.
  • I have a public key whose fingerprint is F411 25CE 791C A0AD 369D 0A31 4C2A 1008 8001 3952

To claim this, I am signing this object:

#!/usr/bin/env ruby
# This script sorts static libraries in the topological order suitable for
# passing to ld. No need for --start-group/--end-group anymore. Should speed
# up the linking a bit. When the libraries contain actual circular dependecies
# the script will detect minimal groups of those and surround them with
# --start-group/--end-group.
#
# To run you need Linux (maybe OS X), Ruby 1.9+ and the rgl gem installed:
#
@hanumantmk
hanumantmk / example.h
Created May 5, 2014 15:20
EncodedValue gen_example.py output header
#include "EncodedValue.h"
template <bool convertEndian = true>
class Complex {
public:
static const int _size = 0 + sizeof(double) + sizeof(double);
typedef EncodedValue::Impl::Pointer<EncodedValue::Meta::EV<Complex<convertEndian> > > Pointer;
align_struct_init_span = 1
align_var_def_colon = true
align_var_def_span = 0
indent_align_string = true
indent_brace = 0
mod_paren_on_return = remove
nl_after_return = true
nl_func_var_def_blk = 1
align_enum_equ_span = 1
align_func_params = true