Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
#include <windows.h> /* WinAPI */ | |
/* Windows sleep in 100ns units */ | |
BOOLEAN nanosleep(LONGLONG ns){ | |
/* Declarations */ | |
HANDLE timer; /* Timer handle */ | |
LARGE_INTEGER li; /* Time defintion */ | |
/* Create timer */ | |
if(!(timer = CreateWaitableTimer(NULL, TRUE, NULL))) | |
return FALSE; |
#define COBJMACROS | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#include <mfapi.h> | |
#include <mfidl.h> | |
#include <mfreadwrite.h> | |
#include <stdio.h> | |
#include <intrin.h> |
From the WebKit documentation at: | |
http://www.opensource.apple.com/source/WebKit/WebKit-7533.16/chromium/src/mac/WebInputEventFactory.mm | |
// Of Mice and Men | |
// --------------- | |
// | |
// There are three types of scroll data available on a scroll wheel CGEvent. | |
// Apple's documentation ([1]) is rather vague in their differences, and not | |
// terribly helpful in deciding which to use. This is what's really going on. | |
// |
// UIFontDescriptor on iOS 7 or later | |
NSDictionary *traitsAttributes = @{UIFontSymbolicTrait: @(UIFontDescriptorTraitMonoSpace)}; | |
NSDictionary *fontAttributes = @{UIFontDescriptorTraitsAttribute: traitsAttributes}; | |
UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:fontAttributes]; | |
NSArray *array = [fontDescriptor matchingFontDescriptorsWithMandatoryKeys:nil]; | |
for (UIFontDescriptor *descriptor in array) { | |
NSLog(@"%@", descriptor.postscriptName); | |
// NSLog(@"%@", [descriptor objectForKey:UIFontDescriptorNameAttribute]); | |
// NSLog(@"%@", [descriptor objectForKey:UIFontDescriptorVisibleNameAttribute]); |
#!/bin/bash | |
# from http://habrahabr.ru/post/108240/ | |
ncpus=`grep -ciw ^processor /proc/cpuinfo` | |
test "$ncpus" -gt 1 || exit 1 | |
n=0 | |
for irq in `cat /proc/interrupts | grep eth | awk '{print $1}' | sed s/\://g` | |
do | |
f="/proc/irq/$irq/smp_affinity" |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
Red [ | |
Title: "JSON parser" | |
File: %json.red | |
Author: "Nenad Rakocevic, Qingtian Xie" | |
License: "BSD-3 - https://github.com/red/red/blob/master/BSD-3-License.txt" | |
] | |
json: context [ | |
quoted-char: charset {"\/bfnrt} | |
exponent: charset "eE" |
system/view/auto-sync?: no | |
grid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep random true]]]] | |
scratchgrid: collect [repeat i 50 [keep/only collect [repeat j 50 [keep false]]]] | |
a: copy grid/1 | |
b: copy grid/50 | |
c: collect [keep/only b keep grid keep/only a] | |
count-neighbors: function [gridd x y][ |