Skip to content

Instantly share code, notes, and snippets.

@uucidl
uucidl / STL-WTF.org
Last active September 27, 2015 12:57
STL WTF

Results

All tested on OSX Yosemite with Apple LLVM version 7.0.0 (clang-700.0.72)

Debug Mode

Debug mode is important. It’s the performance you get when you’re developing and debugging after all.

/usr/bin/clang++ [/usr/bin/clang++, -std=c++14, -g, -isystem, /Users/nicolas/code/third-party/SGI-STL/modules/EASTL/include, /Users/nicolas/code/third-party/SGI-STL/tests/test_vector.cpp, -o, /Users/nicolas/code/third-party/SGI-STL/test_vector]
@uucidl
uucidl / dfw-on-producing-litterature.org
Last active December 5, 2015 16:35
David Foster Wallace: On Producing Litterature

https://youtu.be/mfjjSj9coA0?t=969

When you’re teaching undergrads, they’re not generating litterature. Most of them are coming from a highschool experience where they’re taught a model of writing that is fundamentally expressive.

That is, we want you to write therefore anything you do is good. This is good because you did it.

@uucidl
uucidl / dfw-on-the-freedom-to-be-crummy.org
Last active December 5, 2015 16:38
David Foster Wallace on the freedom to be crummy (his editing routine)

The Freedom To Be Crummy

https://youtu.be/mfjjSj9coA0?t=2582 43:00

So I write the first draft long hand, The second draft I rewrite long-hand on a clipboard, then I type it once, then I retype it then it sits for at least a week or two and I redo it, I type it again. And not “computer” re-typing, but starting all the way at the beginning as a hard copy. Why you ask? Good question.

@uucidl
uucidl / skeleton.cpp
Created December 24, 2015 09:58
skeleton in the closet
/*
OSX: "clang++ -DOS_OSX -g -std=c++11 -nostdinc++ -nostdlib -framework System
-Wall -Wextra skeleton.cpp -o skeleton"
*/
// Meta
#define DOC(...) // to document a symbol
#define URL(...) // reference to a resource
// Compiler
#define CLANG_ATTRIBUTE(x) __attribute__((x))
#define debugger_break() DOC("invoke debugger") asm("int3")
@uucidl
uucidl / cocoa.mm
Created January 31, 2016 14:27
Minimal Cocoa App
#define BUILD(__os,...)
#define DOC(...)
#define TAG(...)
BUILD(osx,"clang++ -std=c++11 cocoa.mm -o cocoa -framework AppKit")
#import "AppKit/AppKit.h"
int main(int argc, char **argv)
{
[NSApplication sharedApplication];
[NSApp setActivationPolicy: NSApplicationActivationPolicyRegular];
auto const app_name = [[NSProcessInfo processInfo] processName];
@uucidl
uucidl / insane.py
Created March 15, 2016 08:45
Something insane I did not know about python
H:\temp>python
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 'hello'
>>> print a
hello
>>> words = [a for a in ['one', 'two', 'three']]
>>> print words
['one', 'two', 'three']
>>> print a
@uucidl
uucidl / authorship.org
Created April 17, 2016 16:03
Some notes about art and creation

Some notes about art and creation.

  1. It is helpful to distinguish between the author-creator, the author-public-figure and the author-critic.
  2. One commonly made mistake is to consider the author-creator knows what kind of statement their creations make.
  3. There isn’t one and only one value to a creation.
  4. It is fallacious to factor out the technological and social context of a creation, both for the author and the spectator.
  5. It is interesting to find out who makes and enforces the rules that make an author’s recognition possible.
  6. A creation is a window into human nature.
  7. One helpful axis to analyze discipline is how abstracted they are from the pure gesture of creation.
  8. One purpose of craft is to impose on us the illusion that the artificial is real.

One is young or old depending on how one confronts change.

The old feels frustration. The young accepts change and takes profit of it.

Young is one who find home in the foreign. Those who grasp their old sweet routine for comfort, those who can’t accept disorientation are from another era.

@uucidl
uucidl / 16ms.org
Last active May 7, 2016 08:01
16ms

period not frequency

how many?

  • simple integer arithmetic (add/sub/shift)
  • complex integer arithmetic (mul/div/mod)
  • float arithmetic (add/mul/div)
  • file open/write/close
  • memory location visited (contiguous, pointer chasing)
  • pixels drawn
@uucidl
uucidl / c4668-preprocessor-script.bat
Created July 11, 2016 20:43
Pragma disabling warning 4668 are not honored in time by the MSVC pre-processor
@echo off
REM a normal compilation runs through
cl.exe main.cpp /Z7 /nologo /c -DWIN32 -W4 -WX -Wall -wd4514
REM however the pre-processor fails because of -WX and C4668
cl.exe main.cpp /Z7 /nologo /c -DWIN32 -W4 -WX -Wall -wd4514 -E