Skip to content

Instantly share code, notes, and snippets.

View honux77's full-sized avatar
🏠
Working from home

Hoyoung Jung honux77

🏠
Working from home
View GitHub Profile
@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 / amoosoo.py
Last active October 23, 2025 07:27
Generate Random User data
import numpy as np
def generateMoney(numPlayers):
# global variables and Constants
MAX_MONEY = 9_999_900
MIN_MONEY = 0
STEP = 100
# μ •κ·œλΆ„ν¬ μ„€μ •
mean = (MAX_MONEY - MIN_MONEY) / 2 # 쀑앙값을 ν‰κ· μœΌλ‘œ
std_dev = mean / 6 # λŒ€λž΅ Β±3Οƒκ°€ 전체 λ²”μœ„κ°€ λ˜λ„λ‘ μ„€μ •
# μ •κ·œλΆ„ν¬λ‘œ λ‚œμˆ˜ 생성
@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;