Skip to content

Instantly share code, notes, and snippets.

@hodduc
hodduc / keybase.md
Created January 29, 2018 02:55
keybase.md

Keybase proof

I hereby claim:

  • I am hodduc on github.
  • I am hodduc (https://keybase.io/hodduc) on keybase.
  • I have a public key ASBWwyUs5BkN1nsITORBq7WgUqeB2qg3kuOBQcgGXQeN8Ao

To claim this, I am signing this object:

@hodduc
hodduc / user-data
Last active September 22, 2015 07:51 — forked from philips/user-data
Running consul on top of CoreOS utilizing etcd for automatic bootstrapping.
#!/bin/bash
source /etc/environment
name=$(cat /etc/machine-id)
if [ ! -f /opt/consul ]; then
mkdir /opt
mkdir /var/lib/consul
curl http://storage.googleapis.com/ifup-org-tilde/consul-0.2.0-linux-x86-64.lzma | lzcat > /opt/consul
chmod +x /opt/consul
@hodduc
hodduc / Custom.css
Created August 27, 2014 02:28 — forked from ssut/Custom.css
/*
* 정확히 AppleGothic만 다른 글꼴로 바꾸는 사용자 스타일 시트
*
* 애플고딕을 쓰도록 명시적으로 지정한 사이트에서도 원하는 글꼴로 바꿀 수 있게 해주는 방법이며,
* 영문 글꼴이나 다른 한글 글꼴까지 몽땅 하나로 통일해서 써야 했던 font-family를 강제로 지정하는 방식과는 달리
* 정확히 애플고딕만 다른 글꼴로 바꿔서 사용하는 매우 깔끔한 방법입니다. :)
*
* 사용 방법:
* Safari는 아무 곳에나 저장해두고 환경설정 > 고급 > 스타일 시트에서 파일 선택
* Google Chrome은 ~/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css
@hodduc
hodduc / scroll.js
Last active August 29, 2015 14:03
Auto Page Scroller (Tested on Chrome)
var body = document.body,
html = document.documentElement;
var pos=0;
window.setInterval(function(){
var height = Math.max( body.scrollHeight, body.offsetHeight,
html.clientHeight, html.scrollHeight, html.offsetHeight );
console.log("reload");
#include<stdio.h>
int N;
char buf[100];
int main()
{
scanf("%d", &N);
for(int i = (N << 1); i >= 1; i--)
{
int len = ((i-N) >= 0) * i + ((i-N) < 0) * N;
int space = N ^ (((i-1) ^ N) & -((i-1) < N));
@hodduc
hodduc / SRM503Easy.cpp
Created April 16, 2013 08:59
SRM 503 Easy
#include<vector>
#include<algorithm>
using namespace std;
int d[55][55];
class ToastXToast
{
public:
int bake(vector <int> under, vector <int> over){
sort(under.begin(), under.end());
sort(over.begin(), over.end());
@hodduc
hodduc / SRM500Hard.cpp
Created April 9, 2013 00:10
SRM 500 Hard
#define MOD 500500573
#include<stdio.h>
int cnt[11], tot;
int inv[2501];
int fact[2501];
int invfact[2501];
long long one[2501];
int sq(int m, int n)
{
@hodduc
hodduc / SRM 501 Easy
Last active December 15, 2015 21:59
SRM 501 Easy
double sa, sb;
double d[55][55], m[55][55];
class FoxPlayingGame{
public:
double theMax(int na, int nb, int pa, int pb)
{
int i, j;
sa = pa / 1000.0;
sb = pb / 1000.0;
d[0][0] = m[0][0] = 0;
#include<vector>
#include<memory.h>
using namespace std;
int buf[555];
class MafiaGame {
public:
double probabilityToLose(int N, vector <int> decisions)
{
int i, maxv = 0, cc, maxc = 0;