Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@objmagic
objmagic / _locale.h
Created March 30, 2018 18:24
locale headers under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
SETLOCALE(3)             BSD Library Functions Manual             SETLOCALE(3)

NAME
     setlocale -- natural language formatting for C

LIBRARY
 Standard C Library (libc, -lc)
@objmagic
objmagic / bad.graphql
Created November 20, 2017 18:47
large graphql
{
e_30_867212753412304896:E(key:{ d:30, e:867212753412304896 }) {
fieldA {
description
d
e
name
l {
apple
c
@objmagic
objmagic / bt
Created July 14, 2017 04:39
stack trace stream manager
(gdb) bt
#0 0x00007fa474c711d7 in raise () from /lib64/libc.so.6
#1 0x00007fa474c728c8 in abort () from /lib64/libc.so.6
#2 0x00007fa4759999d5 in __gnu_cxx::__verbose_terminate_handler() () from /lib64/libstdc++.so.6
#3 0x00007fa475997946 in ?? () from /lib64/libstdc++.so.6
#4 0x00007fa475997973 in std::terminate() () from /lib64/libstdc++.so.6
#5 0x00007fa475997b93 in __cxa_throw () from /lib64/libstdc++.so.6
#6 0x000000000040a27f in (anonymous namespace)::cpp_alloc (nothrow=false, size=1572832) at src/tcmalloc.cc:1458
#7 0x000000000062a4b5 in cpp_alloc (nothrow=false, size=1572832) at src/tcmalloc.cc:1466
#8 tc_new (size=1572832) at src/tcmalloc.cc:1612
@objmagic
objmagic / doubledich.ml
Last active March 28, 2016 10:20
Double dichotomy to determine set of x such that x + a == b, given value of a and b
(* double dichotomy to determine floating point range for x
in ``x + a == b``, given value of ``a`` and ``b`` *)
type t =
| Range of float * float
| Single of float
| Empty
let to_string = function
| Range (l, u) -> Printf.sprintf "{%.16e ... %.16e}" l u
| Single f -> Printf.sprintf "{%.16e}" f
@objmagic
objmagic / dicho.ml
Created March 22, 2016 13:30
dichotomy
(* x + a = b
xl + au >= bl *)
let au = 4.0
let bl = float_of_string "0x0.0000000000001p0"
let neg_zero = Int64.float_of_bits 0x8000_0000_0000_0000L
let pos_zero = Int64.float_of_bits 0x0000_0000_0000_0000L
@objmagic
objmagic / keybase.md
Created March 20, 2016 04:58
keybase.md

Keybase proof

I hereby claim:

  • I am marklrh on github.
  • I am obj (https://keybase.io/obj) on keybase.
  • I have a public key whose fingerprint is 0845 664C 7DB7 4D16 14AF 15B2 9BAE C3C4 D9BC 675E

To claim this, I am signing this object:

@objmagic
objmagic / gener.ml
Last active January 20, 2016 20:58
let-rec-and generalization happens after resolutions of all mutually recursive funtions
module S1 = struct
let f p sep =
let r = p () in
match r with
| None -> `A (sep ())
| Some l -> `B l
end
@objmagic
objmagic / automation.txt
Created January 19, 2016 02:54
calc transition
State 0:
s' -> . s [ # ]
-- On LPAREN shift to state 1
-- On ID shift to state 2
-- On t shift to state 3
-- On s shift to state 11
-- On f shift to state 6
-- On e shift to state 12
State 1: