Skip to content

Instantly share code, notes, and snippets.

View taeguk's full-sized avatar
❄️
asdf

Taeguk Kwon taeguk

❄️
asdf
View GitHub Profile
@taeguk
taeguk / aa.cpp
Last active December 20, 2015 12:44
aa.cpp
class A {
private:
A() {};
public:
static A factory_A() { reutrn A(); }
}
// friend declaration for std::make_shared
// works on VS2010
friend std::tr1::_Ref_count_obj<T>
@taeguk
taeguk / gen_rand_num_nondup.c
Created December 21, 2015 09:53
Generate non-duplicate random numbers
void gen_rand_num_nondup(int *arr, int cnt, int s_num, int e_num)
{
int range = e_num - s_num;
int in, im;
for (in = 0, im = 0; in < range && im < cnt; ++in) {
int rn = range - in;
int rm = cnt - im;
if (rand() % rn < rm)
arr[im++] = in + s_num;
}
@taeguk
taeguk / push_link.bash
Last active January 7, 2016 10:47
Simple pushbullet-bash
@taeguk
taeguk / SlimeWarAI.lua
Last active January 7, 2016 10:53
Lua file for SSM SlimeWar AI Contest
--[[
Slime War Battle AI by taeguk
Recent modified in 2015-07-18
]]--
-- [applied methods]
-- Board:moveQSlime(fromx,fromy,tox,toy)
-- Board:moveSlime(fromx,fromy,tox,toy,number)
-- Board:getSlime(x,y)
-- Board:getTerritory(x,y)
@taeguk
taeguk / fabfile.py
Created January 7, 2016 10:48
릴리즈 랩실 자동화를 위한 툴
from fabric.api import *
import sys
env.hosts = []
MAX_TRYING_CNT = 3
#trying_cnt = 1
env.password = 'releaseworld'
#include <iostream>
class B;
class A {
public:
unsigned int checksum;
private:
B& b;
A(B& b)
@taeguk
taeguk / effectivecpp11.cpp
Last active May 18, 2016 15:52
effective C++ Korean Book no.11 my example
#include <algorithm>
typedef int Data;
// Self assignment : Unsafe
// Exception : Unsafe
class Unsafe {
public:
Data *pData;
Unsafe& operator=(const Unsafe& obj) {
@taeguk
taeguk / EC++47.cpp
Created May 30, 2016 14:10
EC++ no.47 my example
#include <iostream>
// 특성정보에 대한 tag들.
struct walk_ability_tag {};
struct jump_ability_tag {};
struct fly_ability_tag {};
struct run_ability_tag :public walk_ability_tag {};
struct ground_ability_tag :public run_ability_tag, public jump_ability_tag {};
struct all_ability_tag :public ground_ability_tag, public fly_ability_tag {};
@taeguk
taeguk / EC++48.cpp
Last active May 30, 2016 19:37
EC++ no.48 my example.
#include <iostream>
template <unsigned N>
struct IsPrime {
static_assert(N >= 2, "The number must not be less than 2.");
IsPrime() = delete;
static bool value() { return static_cast<bool>(_value); }
private:
@taeguk
taeguk / scalability.txt
Last active September 29, 2016 07:02
A thinking note for Parallel Program's Scalability.
Strong Scalability
---------------------
Efficiency = c. (always)
c : constant.
* n, p can't affect efficiency in strong scalability.
Weak Scalablility
------------------------