Skip to content

Instantly share code, notes, and snippets.

View dongkwan-kim's full-sized avatar
🎯
Focusing

Dongkwan Kim dongkwan-kim

🎯
Focusing
View GitHub Profile
wget https://github.com/google/googletest/archive/release-1.7.0.tar.gz
tar xf release-1.7.0.tar.gz
cd googletest-release-1.7.0
cmake .
make
cp -a include/gtest ../KENSv3/include
cp -a libgtest* ../KENSv3/lib
cd ..
rm release-1.7.0.tar.gz
rm -rf googletest-release-1.7.0/
@dongkwan-kim
dongkwan-kim / my_nginx.conf
Last active February 25, 2017 11:22
my_nginx.conf with ssl
upstream django {
server unix:///home/(.*)/(.*).sock;
}
# configuration of the server
server {
listen 80;
listen 443 ssl;
server_name (.*);
charset utf-8;
@dongkwan-kim
dongkwan-kim / my_uwsgi.ini
Created February 25, 2017 11:21
my_uwsgi.ini with ubuntu, django
[uwsgi]
chdir = /home/ubuntu/(.*)
module = (.*).wsgi
home = /home/ubuntu/env
master = true
processes = 10
socket = /home/ubuntu/(.*)/(.*).sock
@dongkwan-kim
dongkwan-kim / pintos-test-repeat.sh
Last active May 21, 2017 02:09
test-repeat shell script for pintos
#! /bin/bash
# make sure there's ./testresult directory
# For individual test: $ bash test.sh testdir/testname
# For whole test: $ bash test.sh
test_all() {
for i in $(seq 1 10)
do
make clean > testresult/dummy.txt
make > testresult/dummy.txt
@dongkwan-kim
dongkwan-kim / bashrc_pintos.sh
Last active September 4, 2017 07:31
bashrc for pintos
# for git
alias gitpintos="git clone git@github.com:todoaskit/pintos.git"
# for pinto settings
alias pintosrun="pintos -v --bochs -- -q run"
# indivisual test
result() {
make
echo ""
@dongkwan-kim
dongkwan-kim / trolling_whoami.js
Created April 27, 2017 10:06
trolling whoami (guessing.me)
for(var i = 0; i < 10; i ++){
var x = Math.floor((Math.random() * 80) + 1);
$("div[data="+x+"]").click();
};
$("#submit").click();
@dongkwan-kim
dongkwan-kim / toCamel.sh
Created April 29, 2017 16:05
shell script to change snake_case to camelCase
#! /bin/bash
# usage bash toCamel.sh target.js
# snake_func -> snakeFunc
for i in $(seq 1 30)
do
cat $1 | sed -r 's/([a-z]+)_([a-z])([a-z]+)/\1\U\2\L\3/g' > temp
mv temp $1
done
@dongkwan-kim
dongkwan-kim / twitterMoveVote.js
Created May 8, 2017 13:32
Move vote in twitter voting
function moveVote(idx)
{
var voted = 'url(//ton.twimg.com/tfw/assets/checkmark_circle_v1_06f15f494d711c69b89c759b68d1fcbbecdca631.svg)';
for(var i = 1; i <= 4; i += 1)
$('.PollXChoice-choice--selected[data-poll-index="' + i + '"]').style.backgroundImage = "None";
$('.PollXChoice-choice--selected[data-poll-index="' + idx + '"]').style.backgroundImage = voted;
}
moveVote(2);
import random, sys
"""
기차에 100명의 승객이 순서대로 탄다. 첫 번째 승객이 티켓을 잃어 버려서 랜덤한
자리에 앉는다. 두 번째 승객부터는 자기 자리가 비어있으면 자기 자리에 앉고, 누가
앉아있으면 랜덤한 자리에 앉는다. 100번째 승객이 자기 자리에 앉을 확률은?
"""
def run(num):
passengers = list(range(1, num+1))
xargs -a requirements.txt -n 1 pip3 install