Each iteration takes the same amount of time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_secret_key(): | |
from random import choices | |
from string import ascii_letters, digits | |
return "".join(choices(ascii_letters + digits, k=64)) | |
if __name__ == "__main__": | |
generate_secret_key() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: redis-config | |
data: | |
redis.conf: | | |
# Redis configuration file example. | |
# | |
# Note that in order to read the configuration file, Redis must be | |
# started with the file path as first argument: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# >>> java | |
export JAVA_HOME_8=$(/usr/libexec/java_home -v8) | |
export JAVA_HOME=$JAVA_HOME_8 | |
# <<< java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_median(arr): | |
arr.sort() | |
center = len(arr)//2 | |
return (arr[center] + arr[-center - 1]) // 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Check auto increment | |
SELECT | |
table_name, auto_increment | |
FROM | |
information_schema.tables | |
WHERE | |
table_schema = 'YOUR_SCHEMA_NAME' AND auto_increment IS NOT NULL; | |
-- Alter auto increment | |
ALTER TABLE schema_name.table_name MODIFY id BIGINT NOT NULL AUTO_INCREMENT; |
memory reallocation (or doubling) when put element into dynamic array
동적 배열은 미리 초깃값을 작게 잡아 배열을 생성하고
데이터가 추가되어 배열이 꽉 찰 때마다, 배열의 크기를 늘려주고 값을 모두 복사하는 방식으로 구현됩니다.
이때, 배열의 크기를 늘려나가는 배율을 '그로스 팩터(Growth Factor, 성장 인자)'라고 함.
대개는 더블링(Doubling)이라 하여 그로스 팩터를 2로 한다.
(각 언어마다 늘려가는 비율은 상이하다.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func SubQueryRawJoin(subQuery, aliasOfSubQuery, tableName, tableNameAlias string, filters []string, joinSet map[string][][]string, orderByInfo map[string][]string) string { | |
filter := "*" | |
if len(filters) > 0 { | |
filters = func() []string { | |
var result []string | |
for _, f := range filters { | |
if len(strings.Split(f, ".")) < 2 { | |
f = fmt.Sprintf("%s.%s", tableNameAlias, f) | |
} | |
result = append(result, f) |