Skip to content

Instantly share code, notes, and snippets.

View nkuln's full-sized avatar

Gant Kulnirundorn nkuln

View GitHub Profile
ส่งครบ 5 คนแล้ว ขอปิดกล่องนะครับ :-) ขอบคุณที่มาเล่นด้วย สนุกดี
$ th sample.lua cv/lm_lstm_epoch22.73_0.6392.t7 -gpuid -1 -temperature 0.8 -primetext เต่าถุย -length 20000
creating an lstm...
seeding with เต่าถุย
--------------------------
เต่าถุยมากลายครั้ง.
บางคนที่เธอสุดท้าย, อะไรทะเลอยไม่, ความออกมันจำไกลแแล้ว, ต้นครีเที่ตัวเองผู้นั้นไม่ว่า, นอนที่ทุกคนตัน, รอยยับสวยงาม, ที่เธอรักตัวอ่อนไม่มี.
ความสุขทำจากกันมาให้ดอกไม้ให้ดูดวงดาวออกจากหายไป.
ฉันได้มีความสุข.
การรอคอยทะเลดีเสียใจที่ไม่รัก
ฉันพอใจก็ความสิ่งที่กับความหมาย, วันธีน้ำตาหาน์, เปล่า, ความพบว่าสำหรับเท้านั้น, พูดกัด, หนึ่งมันสุดน้ำตามีหาไม่ไม่มีความสุขตาย
@nkuln
nkuln / gettimestamp_cpp_windows.cpp
Created October 19, 2011 11:00
Demonstrate problem from getting 64-bit timestamp to nanosec in Windows
// 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);
@nkuln
nkuln / perf_counter_timer.hpp
Created October 20, 2011 10:36
Example for QueryPerformanceCounter to get current time in Windows C++
//
// 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>
@nkuln
nkuln / test_mixin.py
Created October 20, 2011 18:00
Playing with Mixin which is basically a multiple inheritance. I was confused before on what the line 'cls = TestMixin' does ..
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'
#include <sys/time.h>
#include <stdio.h>
#include <unistd.h>
// ..
struct timeval t;
gettimeofday(&t, NULL);
rfa::common::Int64 now;
now = t.tv_sec;
@nkuln
nkuln / blogger_snippet.js
Created May 1, 2012 12:11
Adding source code to my blogger account
<script class="brush: js; toolbar: false" type="syntaxhighlighter">
<![CDATA[
System.Threading.Parallel.For(0, maxNum + 1, => IsPrime(x));
]]>
</script>
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
@nkuln
nkuln / v8_code_sample.cpp
Created August 6, 2012 08:44
V8 Code Sample
// 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);
@nkuln
nkuln / filename_replace.sh
Created September 15, 2012 11:54
Simple batch file name replace in bash
!/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"