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
// Demonstrate problem in GetSystemTimeAsFileTime(..) call | |
// The time returned is not very precised | |
// | |
ULARGE_INTEGER prev_timestamp, timestamp; | |
prev_timestamp.QuadPart = 0; | |
for(int i = 0 ; i < 100 ; ++i, prev_timestamp = timestamp){ | |
FILETIME now; | |
GetSystemTimeAsFileTime(&now); |
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
// | |
// PerfCounterTimer: | |
// To get current time in millisecond, use (1000.0 * GetCurrentTime() / GetFrequency()). | |
// Practically, you must cache value from GetFrequency() so that you don't need to | |
// re-query the frequency every time | |
// | |
#pragma once | |
#include <windows.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
class TestMixin(object): | |
member1 = ['gant','from','mixin'] | |
def mixin_method(self): | |
print 'member 1 from self: %s' % self.member1 | |
cls = TestMixin | |
print 'member 1 from cls: %s' % cls.member1 | |
class Cat(TestMixin): | |
member1 = 'meow meow' |
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
#include <sys/time.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
// .. | |
struct timeval t; | |
gettimeofday(&t, NULL); | |
rfa::common::Int64 now; | |
now = t.tv_sec; |
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
#include <dlfcn.h> | |
#include <execinfo.h> | |
typedef void (*cxa_throw_type)(void *, void *, void (*) (void *)); | |
cxa_throw_type orig_cxa_throw = 0; | |
void load_orig_throw_code() | |
{ | |
orig_cxa_throw = (cxa_throw_type) dlsym(RTLD_NEXT, "__cxa_throw"); | |
} |
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
<script class="brush: js; toolbar: false" type="syntaxhighlighter"> | |
<![CDATA[ | |
System.Threading.Parallel.For(0, maxNum + 1, => IsPrime(x)); | |
]]> | |
</script> |
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
Date & Time: 7/12/2012 9:01:28 AM | |
Event Class: File System | |
Operation: CreateFile | |
Result: ACCESS DENIED | |
Path: C:\Users\nkuln\Desktop\APISnapshot_100b\bin\APISnapshot_Service.exe | |
TID: 164 | |
Duration: 0.0015702 | |
Desired Access: Read Data/List Directory, Execute/Traverse, Read Attributes, Synchronize | |
Disposition: Open | |
Options: Synchronous IO Non-Alert, Non-Directory File |
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
// UpaV8PerfTest.cpp : Defines the entry point for the console application. | |
// | |
#include "stdafx.h" | |
using namespace v8; | |
std::string readSourceFile(std::string fileName) | |
{ | |
std::ifstream t(fileName); |
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
!/bin/bash | |
# Debugging .. print all commands executed | |
set -x | |
for f in * | |
do | |
# Replace all occurrences of '%20' with ' ' (single space) | |
newname=${f//%20/ } | |
# We're safer with quotes around .. | |
mv "$f" "$newname" |
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
import MySQLdb as mdb | |
import HTMLParser | |
import random | |
import urllib2 | |
import urlparse | |
from bs4 import BeautifulSoup | |
from os import path | |
class ImageMigrator: |
OlderNewer