Skip to content

Instantly share code, notes, and snippets.

View nicolasnoble's full-sized avatar
😪
I may be slow to respond.

Nicolas Noble nicolasnoble

😪
I may be slow to respond.
View GitHub Profile
#include <iostream>
#include <typeinfo>
#include <string>
#include <memory>
#include <cxxabi.h>
using namespace std;
string demangle(const char * name) {
int status = -1;
;; Function int main() (main, funcdef_no=1196, decl_uid=28518, cgraph_uid=322)
int main() ()
{
int D.29914;
struct __ostream_type & D.29913;
int D.29912;
bool D.29911;
void (*<T5f4>) (void) D.29910;
struct __lambda0 D.28533;
#define __DBL_MIN_EXP__ (-1021)
#define __UINT_LEAST16_MAX__ 65535
#define __ATOMIC_ACQUIRE 2
#define __FLT_MIN__ 1.17549435082228750797e-38F
#define __GCC_IEC_559_COMPLEX 2
#define __UINT_LEAST8_TYPE__ unsigned char
#define _WIN32 1
#define __INTMAX_C(c) c ## LL
#define __CHAR_BIT__ 8
#define __UINT8_MAX__ 255
void HandleRpcs() {
new CallData(&service_, cq_.get());
void* tag;
bool ok;
while (true) {
switch (cq_->AsyncNext(&tag, &ok, gpr_inf_past) {
case TIMEOUT:
doSomethingElseForALittleWhile();
continue;
case SHUTDOWN:
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
static void grpc_rb_shutdown(VALUE val) {
(void)val;
grpc_shutdown();
}
#endif
@nicolasnoble
nicolasnoble / gen-data.c
Created September 3, 2018 03:49
Generate random, yet compressible data.
static void gen_pre_buf(uint8_t * pre_buf, uint8_t (*get_byte)(void *), void * opaque) {
int i;
memset(pre_buf, 0, 1024);
for (i = 0; i < 256; i++) {
pre_buf[i + 256] = i;
pre_buf[i * 2 + 512] = i;
}
const github = require('octonode')
const repoName = /* repository name */
const client = github.client(/* user token */)
const repo = client.repo(repoName)
async function migrateAll() {
let page = 1
while (true) {
const prsResult = await repo.prsAsync({page: page, state: 'open'})
#define NOMINMAX
#define _CRT_SECURE_NO_WARNINGS
#ifdef _WIN32
#define WIN32LEANANDMEAN
#include <windows.h>
#endif
#include <assert.h>
#include <ctype.h>
#include <stdint.h>
class DiscreteCos {
public:
DiscreteCos() { generate(); }
static const unsigned int DC_2PI = 2048;
static const unsigned int DC_PI = 1024;
static const unsigned int DC_PI2 = 512;
int32_t cos(unsigned int t) {
t %= DC_2PI;
int32_t r;
class DiscreteCos {
public:
DiscreteCos() { generate(); }
static const unsigned int DC_2PI = 2048;
static const unsigned int DC_PI = 1024;
static const unsigned int DC_PI2 = 512;
int32_t cos(unsigned int t) {
t %= DC_2PI;
int32_t r;