This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// attribution: http://stackoverflow.com/a/15281070/32453 | |
// you can compile this with gcc [mingw or mingw-w64] and probably other compilers as well | |
#include <stdlib.h> // NULL | |
#include <stdbool.h> // false | |
#include <windows.h> // AttachConsole, CTRL_C_EVENT, etc. | |
#include <stdio.h> // printf | |
#include <strsafe.h> | |
void logLastError() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/crc32c' # gem install digest-crc | |
p 'syntax: something to get digested! [output it with trailing 4 byte digest, in ruby string syntax]' | |
checksum = Digest::CRC32c.checksum(ARGV[0]) | |
p checksum | |
out = ARGV[0].dup.bytes # assume it starts ascii :| | |
for n in [24, 16, 8, 0] | |
next_byte = (checksum >> n & 0xff) | |
out << next_byte | |
p "x%x" % next_byte | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
// doesn't work, unfortunately :| | |
// #include <windows.h> | |
// #include <psapi.h> | |
import "C" | |
import "unsafe" | |
import "fmt" | |
import "syscall" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10-16 20:36:04.927 4174-4201/com.android.chrome:privileged_process0 D/EGL_emulation: eglMakeCurrent: 0x91690820: ver 2 0 (tinfo 0xafb83b80) | |
10-16 20:36:04.932 4174-4201/com.android.chrome:privileged_process0 D/EGL_emulation: eglMakeCurrent: 0x90b85f40: ver 2 0 (tinfo 0xafb83b80) | |
10-16 20:36:04.947 4174-4201/com.android.chrome:privileged_process0 D/EGL_emulation: eglMakeCurrent: 0x90b83000: ver 2 0 (tinfo 0xafb83b80) | |
10-16 20:36:04.948 4174-4201/com.android.chrome:privileged_process0 D/EGL_emulation: eglMakeCurrent: 0x90b85f40: ver 2 0 (tinfo 0xafb83b80) | |
10-16 20:36:04.951 4174-4201/com.android.chrome:privileged_process0 D/EGL_emulation: eglMakeCurrent: 0x90b83000: ver 2 0 (tinfo 0xafb83b80) | |
10-16 20:36:04.952 4174-4201/com.android.chrome:privileged_process0 D/EGL_emulation: eglMakeCurrent: 0x90b85f40: ver 2 0 (tinfo 0xafb83b80) | |
10-16 20:36:04.962 4174-4201/com.android.chrome:privileged_process0 D/EGL_emulation: eglMakeCurrent: 0x91690820: ver 2 0 (tinfo 0xafb83b80) | |
10-16 20:36:04.964 4174-4201/com.android.chr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// enum.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
#include <cstdio> | |
#include <cstring> | |
#include <windows.h> | |
#include <comcat.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int rcvBufferSize; | |
int sockOptSize = sizeof(rcvBufferSize); | |
getsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &rcvBufferSize, &sockOptSize); | |
printf("initial socket receive buf %d\n", rcvBufferSize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to_encode = "abcdABCD" | |
outy = Array(UInt8).new | |
to_encode.each_char{|c| | |
if c.in_set?("A-Z") | |
outy << 0x41_u8 + (c - 'A') # https://en.wikipedia.org/wiki/EIA-608#Characters | |
elsif c.in_set?("a-z") | |
outy << 0x61_u8 + (c - 'a') | |
else | |
raise "don't translate more chars yet" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -vS rake build --trace | |
ruby 1.9.2p290 (2011-07-09) [i386-mingw32] | |
(in c:/dev/ruby/sane) | |
C:/installs/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler/tasks.rb:46: warning: method redefined; discarding old jeweler | |
C:/installs/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler/specification.rb:110: warning: method redefined; discarding old initialize_copy | |
C:/installs/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1352: warning: previous definition of initialize_copy was here | |
** Invoke build (first_time) | |
** Execute build | |
C:/installs/Ruby192/lib/ruby/gems/1.9.1/gems/jeweler-1.5.2/lib/jeweler/tasks.rb:47: warning: instance variable @jeweler not initialized | |
C:/installs/Ruby192/lib/ruby/gems/1.9.1/gems/git-1.2.5/lib/git/object.rb:25: warning: method redefined; discarding old size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
long double PCFreqMillis = 0.0; | |
// this call only needed once... | |
// who knows if this is useful or not, speed-wise... | |
void WarmupCounter() | |
{ | |
LARGE_INTEGER li; | |
BOOL ret = QueryPerformanceFrequency(&li); | |
assert(ret != 0); // only gets run in debug mode LODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "benchmark" | |
require "uuid" | |
Benchmark.ips do |x| | |
x.report { UUID.random } | |
end |
NewerOlder