Skip to content

Instantly share code, notes, and snippets.

Avatar

Sangkon, Han sigmadream

View GitHub Profile
View ConstantTransformer.py
import ast
import decimal
class ConstantTransformer(ast.NodeTransformer):
def visit_Constant(self, node):
decimal = ast.copy_location(ast.Name(id='decimal', ctx=ast.Load()), node)
Decimal = ast.copy_location(ast.Attribute(value=decimal, attr='Decimal', ctx=ast.Load()),node)
Constant = ast.copy_location(ast.Str(s=str(node.n)), node)
return ast.copy_location(ast.Call(func=Decimal,args=[Constant],keywords=[]),node)
View 멜론TOP100 가져오기.py
import requests
from bs4 import BeautifulSoup
RANK = 100
header = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko'}
req = requests.get('https://www.melon.com/chart/index.htm', headers = header)
html = req.text
parse = BeautifulSoup(html, 'html.parser')
View app_1.js
import React, { useState } from 'react';
import {
Button,
ScrollView,
StyleSheet,
Text,
TextInput,
View,
} from 'react-native';
View clues.py
def make_clues():
clues = {
Vertex(0, 2): 3,
Vertex(0, 5): 7,
Vertex(0, 8): 5,
Vertex(1, 0): 4,
Vertex(1, 1): 5,
Vertex(1, 3): 9,
Vertex(1, 4): 1,
Vertex(2, 3): 5,
@sigmadream
sigmadream / dmoj-setup.md
Last active Jun 2, 2020
DMOJ 설치 관련
View dmoj-setup.md
  • 주의, Ubuntu 20.04 이상에서 작동
$ sudo apt update -y
$ sudo apt upgrade -y
$ sudo apt install -y python-is-python3
$ sudo apt install -y python3-venv python3-pip
$ sudo apt install -y git gcc g++ make libxml2-dev libxslt1-dev zlib1g-dev python3-dev gettext curl wget redis-server

$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
@sigmadream
sigmadream / add-button.html
Last active Apr 22, 2020
2020.04.12 ~ 04.18 (#05) – MVC 패턴(2), View과 관련된 코드
View add-button.html
<a href="/add" class="btn btn-primary">
<i class="fas fa-user-plus ml-2">추가</i>
</a>
View mongo-filed-copy.js
var cursor = db.engagementMetric.aggregate([
{ "$project": {
"createdAt": "$createdAt"
}}
])
var requests = [];
cursor.forEach(document => {
requests.push( {
'updateOne': {
View 게시판-read-snippet.md
@GetMapping("/{idx}")
public String read(@PathVariable Long idx, Model model) {
    model.addAttribute("board", boardService.findBoardByIdx(idx));
    return "item";
}

// View

<div class="container">
View 게시판-add-snippet.md
@GetMapping("/new")
public String form(Board board) {
    return "new";
}

// view
<div class="container">
    <div class="page-header">
        <h1>게시글 작성</h1>
View 게시판-add-snippet.md
@GetMapping("/new")
public String form(Board board) {
    return "new";
}

// view
<div class="container">
    <div class="page-header">
        <h1>게시글 작성</h1>