Skip to content

Instantly share code, notes, and snippets.

@tonymagro
tonymagro / array_profile.cpp
Last active April 26, 2023 22:49
Array deletion benchmark
#include <iostream>
#include <vector>
#include <list>
#include <chrono>
#include <cstdlib>
#include <ctime>
#include <algorithm>
const int ELEMENTS_COUNT = 1000000;
const int DELETE_COUNT = 10000;
@tonymagro
tonymagro / .clang-format
Created March 13, 2021 08:46
Clang Formatting
---
BasedOnStyle: LLVM
---
Language: Cpp
ColumnLimit: 0
IndentWidth: 4
TabWidth: 4
ContinuationIndentWidth: 4
UseTab: ForContinuationAndIndentation
@tonymagro
tonymagro / xmlrpc.py
Created February 23, 2021 17:48
XMLRPC Large integers
xmlrpclib.Marshaller.dispatch[type(0L)] = lambda _, v, w: w("<value><i8>%d</i8></value>" % v) # allow long int for userId
@tonymagro
tonymagro / keybase.md
Last active September 27, 2017 19:39
keybase.md

Keybase proof

I hereby claim:

  • I am tonymagro on github.
  • I am tonymagro (https://keybase.io/tonymagro) on keybase.
  • I have a public key whose fingerprint is BC2B 4F40 AE9C 3505 55AF 1187 FA40 E81F C4F3 259F

To claim this, I am signing this object:

// Bug in vs2010 cl.exe version 16.00.40219.01 for 80x86
// Optimizations must be off and inline functions must be enabled.
// compile with `cl /Ob2 msvc2010_inline_instrinsic_bug.cpp`
// Incorrect assembly will be generated if one compiles with optimizations
// off but inline function on ('cl.exe /Ob1') and passes a union
// that's inside a struct to an inlined function by value where the function's
// first use of the union is a vector instrinsic. In this case, the compiler
// will generate assembly that is missing an offset to the union within the struct
// and instead will use the address of the struct directly.
@tonymagro
tonymagro / Clang++.sublime-build
Last active April 22, 2022 00:30
Sublime Build Systems
{
"shell_cmd": "clang++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c++",
"windows": {
"shell_cmd": "clang++ \"${file}\" -o \"${file_path}/${file_base_name}.exe\""
},
@tonymagro
tonymagro / ZIP Headers
Last active August 29, 2015 14:03
Zlib
https://groups.google.com/forum/#!msg/comp.compression/_y2Wwn_Vq_E/SKOF7iE12PEJ
Common:
78 01, 78 5e, 78 9c, 78 da
Rare:
08 1d, 08 5b, 08 99, 08 d7, 18 19, 18 57, 18 95, 18 d3,
28 15, 28 53, 28 91, 28 cf, 38 11, 38 4f, 38 8d, 38 cb,