반응형

분류 전체보기 619

[프로그래머스][SQL] 입양 시각 구하기(2)

https://school.programmers.co.kr/learn/courses/30/lessons/59413 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 0시부터 23시까지, 각 시간대별로 입양이 몇 건이나 발생했는지 조회하는 SQL문을 작성해주세요. 이때 결과는 시간대 순으로 정렬해야 합니다. with recursive timetable as ( select 0 as hour union all select hour+1 from timetable where hour

🍒 SQL/Join 2023.07.19

[TS] type-challenges: 268 - If

문제 조건 `C`, 참일 때 반환하는 타입 `T`, 거짓일 때 반환하는 타입 `F`를 받는 타입 `If`를 구현하세요. `C`는 `true` 또는 `false`이고, `T`와 `F`는 아무 타입입니다. 예시: type A = If // expected to be 'a' type B = If // expected to be 'b' 풀이 type If = C extends true ? T : F type에서 extends가 등호 두개 == 에 해당한다고 보면 편할 것 같다 출처 https://github.com/type-challenges/type-challenges/blob/main/questions/00268-easy-if/README.ko.md

[TS] TypeScript Exercises 7 해석 및 풀이

Intro Filtering was completely removed from the project. It turned out that this feature was just not needed for the end-user and we spent a lot of time just because our office manager told us to do so. Next time we should instead listen to the product management. Anyway we have a new plan. CEO's friend Nick told us that if we randomly swap user names from time to time in the community, it would..

[DreamHack] 드림핵 웹해킹: web-ssrf

https://dreamhack.io/wargame/challenges/75/ web-ssrf flask로 작성된 image viewer 서비스 입니다. SSRF 취약점을 이용해 플래그를 획득하세요. 플래그는 /app/flag.txt에 있습니다. Reference Server-side Basic dreamhack.io 함께 실습인 만큼 풀이는 자료에 다 나와있다. 다만 자료에서 부르트포스로 포트번호를 찾아낼때 파이썬을 이용하는데, 이 코드를 훨씬 더 단순화할 수 있지 않을까 싶어서 간결하게 바꿔봤다. import requests ERROR_RESPONSE = "iVBORw0KGgoAAAANSUhEUgAAA04AAAF4CAYAAABjHKkYAAAMRmlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU..

[프로그래머스][SQL] 오프라인/온라인 판매 데이터 통합하기

https://school.programmers.co.kr/learn/courses/30/lessons/131537 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ONLINE_SALE 테이블과 OFFLINE_SALE 테이블에서 2022년 3월의 오프라인/온라인 상품 판매 데이터의 판매 날짜, 상품ID, 유저ID, 판매량을 출력하는 SQL문을 작성해주세요. OFFLINE_SALE 테이블의 판매 데이터의 USER_ID 값은 NULL 로 표시해주세요. 결과는 판매일을 기준으로 오름차순 정렬해주시고 판매일이 같다면 상품 ID를 기준으로 오름차순, 상품ID까지 같..

🍒 SQL/Select 2023.07.17

[TS] type-challenges: 189 - Awaited

문제 Promise와 같은 타입에 감싸인 타입이 있을 때, 안에 감싸인 타입이 무엇인지 어떻게 알 수 있을까요? 예시: 들어 Promise이 있을 때, ExampleType을 어떻게 얻을 수 있을까요? type ExampleType = Promise type Result = MyAwaited // string 풀이 type MyAwaited = T extends PromiseLike ? MyAwaited : T; Array vs ArrayLike, Promise vs PromiseLike 타입스크립트에는 ArrayLike라는게 존재한다. Array는 일반적인 배열을 의미하는데, ArrayLike는 무엇일까? 이를 알아보기 위해 lib.es5.d.ts에 가서 각각의 스펙을 살펴보자. Array ArrayL..

[TS] TypeScript Exercises 5 해석 및 풀이

Intro Filtering requirements have grown. We need to be able to filter any kind of Persons. 필터링 요구사항이 늘었습니다. 이제 Person의 모든 종류를 구분해야합니다. Exercise Fix typing for the filterPersons so that it can filter users and return User[] when personType='user' and return Admin[] when personType='admin'. Also filterPersons should accept partial User/Admin type according to the personType. `criteria` argument sh..

[DreamHack] 드림핵 웹해킹 : file-download-1

https://dreamhack.io/wargame/challenges/37/ file-download-1 File Download 취약점이 존재하는 웹 서비스입니다. flag.py를 다운로드 받으면 플래그를 획득할 수 있습니다. Reference Introduction of Webhacking dreamhack.io 문제 File Download 취약점이 존재하는 웹 서비스입니다. flag.py를 다운로드 받으면 플래그를 획득할 수 있습니다. 문제파일 더보기 #!/usr/bin/env python3 import os import shutil from flask import Flask, request, render_template, redirect from flag import FLAG APP = Fla..

[TS] type-challenges: 43. Exclude

문제 T에서 U에 할당할 수 있는 타입을 제외하는 내장 제네릭 Exclude를 이를 사용하지 않고 구현하세요. type Result = MyExclude // 'b' | 'c' 풀이 타입이 아닌 단순 문제였다고 생각해보자 function MyExclude(T, U) { if(T === U) return; else return T; } 이런 느낌이다. T에 해당하는 타입들중 U와 같은 타입이 있다면 그건 반환하지 않고, 같지 않다면 반환하는 로직이다. 타입스크립트에서 ===에 해당하는 부분은 extends로 대체 가능하고 아무것도 반환하지 않는 경우는 never 이라는 타입으로 쓸 수 있겠다. type MyExclude = T extends U ? never : T; 출처 https://github.com..

[TS] TypeScript Exercises 5 해석 및 풀이

Intro Time to filter the data! In order to be flexible we filter users using a number of criteria and return only those matching all of the criteria. We don't need Admins yet, we only filter Users. 데이터를 선별할 차례입니다! 보다 유연해지기 위해 우리는 기준을 표시하는 숫자를 이용하여 유저들을 필터링하고, 오직 이 모든 기준에 맞는 유저들만 리턴해야합니다. 아직 Admin들은 필요하지 않고 User들만 필터링하면 됩니다. Exercise Without duplicating type structures, modify filterUsers functio..

반응형