Skip to content

Instantly share code, notes, and snippets.

View sh-cho's full-sized avatar
💬
I may be slow to respond.

Seonghyeon Cho sh-cho

💬
I may be slow to respond.
View GitHub Profile
@sh-cho
sh-cho / cpp11-random-int.cpp
Last active September 5, 2017 16:52
c++11 random int
#include <random>
#include <iostream>
using namespace std;
int main() {
std::random_device rd;
std::mt19937 rng(rd());
std::uniform_int_distribution<int> uni(0, 10000000);
for (int i = 0; i < 10; ++i) {
@sh-cho
sh-cho / is-contain-hangul.c
Created September 5, 2017 16:51
is contain hangul?
#include <stdio.h>
#include <wchar.h> //wcslen
int is_contain_hangul(const wchar_t *str) {
const size_t len = wcslen(str);
const wchar_t start_ch = L'가';
const wchar_t end_ch = L'힣';
register int i;
for (i = 0; i < len; ++i) {
@sh-cho
sh-cho / nana-hello-world.cpp
Created September 5, 2017 18:11
nana hello world program
#include <nana/gui.hpp>
#include <nana/gui/widgets/label.hpp>
int main()
{
using namespace nana;
form fm;
label lb{ fm, rectangle{ 10, 10, 100, 100 } };
lb.caption("Hello, world!");
@sh-cho
sh-cho / pokemon-db-parser.py
Last active September 26, 2017 14:14
pokemon db parser
# parser for this problem (https://www.acmicpc.net/problem/9987)
import requests
from bs4 import BeautifulSoup
if __name__ == "__main__":
url = "http://web.archive.org/web/20140301191716/http://pokemondb.net/pokedex/national"
soup = BeautifulSoup(requests.get(url).text, 'lxml')
list = soup.find_all('span', {'class': 'infocard-tall '})
db = []
@sh-cho
sh-cho / wordcount.l
Created October 15, 2017 06:27
flex wordcount example
/* declaration and option settings */
%{
void addWord(char *text);
void addNewLine(void);
void addChar(void);
int chars = 0;
int words = 0;
int lines = 0;
%}
@sh-cho
sh-cho / torrent2magnet.py
Created October 15, 2017 14:28
extract magnet address from torrent file in python 3
# python3
import magneturi
TORRENT_FILE_NAME = 'ubuntu-16.04.3-desktop-amd64.iso.torrent'
def main():
print(magneturi.from_torrent_file(TORRENT_FILE_NAME))
if __name__ == '__main__':
main()
@sh-cho
sh-cho / concat.c
Last active November 5, 2017 11:49
c string concatenation using snprintf
#include <stdio.h>
#include <string.h>
int main() {
char prefix[100];
snprintf(prefix, sizeof(prefix), "%s-%s", "main-for","abc");
printf("%s\n", prefix);
return 0;
}
Kotlin 🕓 5h26m ████████▎░░░░░░░░░░░░░░ 36.4%
C++ 🕓 3h24m █████▏░░░░░░░░░░░░░░░░░ 22.7%
Lua 🕓 52m █▎░░░░░░░░░░░░░░░░░░░░░ 5.8%
Bash 🕓 48m █▎░░░░░░░░░░░░░░░░░░░░░ 5.5%
Markdown 🕓 42m █░░░░░░░░░░░░░░░░░░░░░░ 4.7%
@sh-cho
sh-cho / daum.py
Created February 13, 2021 10:49
daum webtoon scraper using selenium
import time
import urllib.request
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
VIEWER_PATH = "http://webtoon.daum.net/webtoon/viewer/"
@sh-cho
sh-cho / temurin.sh
Last active October 14, 2021 10:05
# Untap AdoptOpenJDK first
brew untap AdoptOpenJDK/openjdk
# If you want to download latest version
brew install --cask temurin
# To install specific version
brew tap homebrew/cask-versions
brew install --cask temurin8 temurin11