Skip to content

Instantly share code, notes, and snippets.

Heejune heejune

Block or report user

Report or block heejune

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@heejune
heejune / set_package_version.py
Last active Sep 22, 2017
AssemblyInfo.cs update version info
View set_package_version.py
def set_package_version(manifest_file, target_version):
from xml.etree import ElementTree as et
et.register_namespace("", "http://schemas.microsoft.com/appx/manifest/foundation/windows10")
et.register_namespace("mp","http://schemas.microsoft.com/appx/2014/phone/manifest")
et.register_namespace("uap", "http://schemas.microsoft.com/appx/manifest/uap/windows10")
tree = et.parse(manifest_file)
e = tree.find('{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Identity')
View typed_routing_delegator.h
struct routing_record
{
virtual reply handle(void*) abstract;
};
template <typename T>
struct typed_routing_recored;
template <typename RetType, typename classTy, typename... ArgType>
struct typed_routing_recored<RetType(classTy::*)(ArgType...) const> : public routing_record
View routing_delegator.h
struct routing_delegator
{
routing_delegator() {} // default
routing_delegator(std::vector<std::string> r) : ruleset(r) {}
// register functor handler
template <typename F>
void to(F&& f)
{
routing_data = std::make_unique<typed_routing_recored<decltype(&F::operator())>>(f);
View keybase.md

Keybase proof

I hereby claim:

  • I am heejune on github.
  • I am heejune (https://keybase.io/heejune) on keybase.
  • I have a public key ASBTjB-ljb8r_A1ald0ZHD--uWUwa009owTp3KM3FZyKoQo

To claim this, I am signing this object:

View get_nth_prime_with_optimized_sieve.cpp
#include <memory>
// note1. 홀수 n이 주어졌을 때, n이 몇 번째 홀수인지 알아내려면 (n - 3) >> 1 한다.
unsigned long get_nth_prime_with_optimized_sieve(unsigned long n) {
unsigned long precompute_max_count = 200000;
// prime number를 체크하기 위해 우선 대상이 될 모든 odd number들을 담을 배열을 만든다.
vector<bool> odd_numbers_divisible(precompute_max_count/2); // odd numers
View SieveOfEratosthenes.cpp
/// snippet from
/// http://www.geeksforgeeks.org/sieve-of-eratosthenes/
///
std::vector<bool> SieveOfEratosthenes(unsigned long less)
{
// Create a boolean array "prime[0..n]" and initialize
// all entries it as true. A value in prime[i] will
// finally be false if i is Not a prime, else true.
vector<bool> prime(less + 1);
std::fill(begin(prime), end(prime), true);
View get_nth_prime_without_sieve.cpp
unsigned long get_nth_prime_without_sieve(unsigned long n) {
if (n == 0) return 0;
if (n == 1) return 2;
unsigned long prime_num = 3;
unsigned long local_n = 2; // 2th prime number is 3
while (local_n != n) {
View isprime.cpp
bool isPrime(unsigned long num)
{
if (num == 2)
return true;
if (num <= 1 || num % 2 == 0) // 0, 1, and all even numbers
return false;
for (unsigned long x = 3; x*x <= num; x += 2) {
if (num % x == 0)
@heejune
heejune / slack_uploader.py
Created Feb 28, 2017
how to upload a file with SlackClient library
View slack_uploader.py
from slackclient import SlackClient
class SlackBot(object):
'''
SlackBot:
'''
def __init__(self, logger, slackclient):
self.logger = logger or logging.getLogger(__name__)
self.slack_client = slackclient or SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
@heejune
heejune / democore.cpp
Created Feb 25, 2017
wrl and cppwinrt combination
View democore.cpp
winrt::Windows::Foundation::IAsyncOperation<int> GetAsyncOp()
{
using namespace winrt;
using namespace Windows::Foundation;
for (int i = 0; i != 5; ++i)
{
co_await 5000ms;
}
You can’t perform that action at this time.