Skip to content

Instantly share code, notes, and snippets.

@honux77
honux77 / address.ts
Last active December 20, 2020 16:46
address.ts
interface PhoneNumberDictionary {
[phone: string]: {
num: number;
};
}
enum PhoneType {
Home = 'home',
Office = 'office',
Studio = 'studio'
@honux77
honux77 / 5525
Created November 4, 2020 11:24
BOJ 5525 IOI x n
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ull = long long int;
int main()
{
@honux77
honux77 / 18870.cpp
Created October 23, 2020 15:23
BOJ 18870 TE answer
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
using ull = long long int;
int main()
@honux77
honux77 / Main.java
Created June 9, 2020 06:53
BOJ 13335 Fun truck
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class Main {
@honux77
honux77 / 10809.py
Last active June 4, 2020 01:16
BOJ 10809
s = input()
# wrong ab = "abcdefghijklmnopqrstuvxwyz"
ab = "abcdefghijklmnopqrstuvwxyz"
ans = [-1] * len(ab)
for i in range(len(s)):
for j in range(len(ab)):
if s[i] == ab[j] and ans[j] == -1:
ans[j] = i
print(" ".join(map(str,ans)))
@honux77
honux77 / gen-trade.py
Last active September 30, 2024 08:51
Generate Random User data
import sys
import numpy as np
import random
# setup
words = []
if len(sys.argv) < 3:
print("Usage: {} numItem numUser".format(sys.argv[0]))
exit(1)
@honux77
honux77 / logback.xml
Last active March 14, 2020 10:19
Java and Spring cheatsheet
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="STDOUT" />
</root>
@honux77
honux77 / seonsoo-sort.java
Created February 7, 2020 16:05
프로그래머스 완주하지 못한 선수 정렬로 풀기
// 정렬 사용해서 다시 풀었음
import java.util.Arrays;
public class Solution {
public String solution(String[] participant, String[] completion) {
Arrays.sort(participant);
Arrays.sort(completion);
int i;
@honux77
honux77 / atomic.sql
Last active August 20, 2019 15:40
mysql atomic increment example
USE honuxdb;
SET SESSION transaction_isolation='SERIALIZABLE';
# SELECT @@GLOBAL.transaction_isolation, @@transaction_isolation;
START TRANSACTION;
SELECT SLEEP(3);
UPDATE SUA SET B = B + 1 WHERE A = 'YJ';
SELECT * FROM SUA;
@honux77
honux77 / gen-csv.js
Created August 12, 2019 08:34
mysql csv 생성 및 삽입
const NUM = 10;
fs = require('fs');
const ws = fs.createWriteStream('./data.csv');
const genId = (i) => {
const ids = ['apple', 'banana', 'mango', 'tuna' , 'muken',
'ym', 'sony', 'aiwa', 'circus' ];
const prefix = ids[parseInt(Math.random() * ids.length)];
return prefix + i;