Skip to content

Instantly share code, notes, and snippets.

def get_wma(close, weights):
def wma(values, weights):
sum_of_weights = np.sum(weights)
weighted_average = np.sum(values * weights) / sum_of_weights
return weighted_average
return close.rolling(len(weights)).apply(lambda x: weighted_avg(x, weights))
@mindryu
mindryu / is_local_or_colab.py
Last active December 6, 2020 10:34
Check Local or Colab
def is_local():
"""
로컬 실행 여부
"""
server = next(notebookapp.list_running_servers())
return True if server['hostname'] == 'localhost' else False
def is_colab():
"""
코랩 실행여부
@mindryu
mindryu / window_character.gui
Created November 30, 2020 21:05
window_character.gui
######################################################
################# CHARACTER WINDOW ###################
######################################################
window = {
name = "character_window"
datacontext = "[GetVariableSystem]"
datacontext = "[CharacterWindow.GetCharacter]"
movable = no
layer = middle
@mindryu
mindryu / activation & initialization
Created November 30, 2020 17:20
OReilly's Hands-On Machine Learning with Scikit-Learn & Tensorflow
| initialization | activation |
+----------------+-------------------------------+
| glorot | none, tanh, logistic, softmax |
| he | relu & variants |
| lecun | selu |
@mindryu
mindryu / Less Tooltip Text
Last active November 4, 2020 02:45
Less Tooltip Text
l_korean:
OUTLINER_ARMY_CLICK_TO_SELECT:0 ""
OUTLINER_ARMY_CLICK_TO_PAN:0 ""
OUTLINER_ARMY_RIGHT_CLICK_TO_PAN:0 ""
HOLDING_CLICK_TOOLTIP:0 ""
PROVINCE_TOOLTIP_CLICK_TO_GO:1 ""
PROVINCE_TOOLTIP_SHIFT_TO_APPEND:0 ""
PROVINCE_TOOLTIP_CTRL_TO_FORCE_GATHERING:0 ""
CHARACTER_TOOLTIP_INSTRUCTION:0 ""
CHARACTER_TOOLTIP_INSTRUCTION_CODE:0 ""
namespace = holy_order
scripted_effect change_holder_before_lease_out = {
if = {
limit = { NOT = { $TARGET$.holder = root } }
create_title_and_vassal_change = {
type = leased_out
save_scope_as = change
add_claim_on_loss = no
}
@mindryu
mindryu / can_be_granted_titles_by
Last active November 4, 2020 10:52
Grant to faith head and dynasty member
grant_titles_interaction = {
category = interaction_category_vassal
common_interaction = yes
desc = grant_titles_interaction_desc
special_interaction = grant_titles_interaction
interface = grant_titles
target_type = title
# Will AI for this character try to arrange matrilineal marriages?
# Note that the AI can still arrange patrilineal marriages based on the SPOUSE_SCORE_LINEALITY_MISMATCH_SCORE AI define
# root: the arranging AI character
# scope:secondary_actor: the character to be married
ai_wants_matrilineal_marriage = {
scope:secondary_actor = {
is_female = yes
}
trigger_if = {
@mindryu
mindryu / colab.css
Last active December 8, 2020 02:40
colab dark background
.view-line {
font-family: D2Coding;
}
/* Monaco Input Area */
.monaco-editor-background,
.monaco-editor .inputarea.ime-input {
background-color: #000;
}
@mindryu
mindryu / JupyterKeyboardShortcut.json
Created May 17, 2019 03:11
Jupyterlab Keyboard Shortcut
{
// 오토 포맷
"jupyterlab_code_formatter:black":{
"command":"jupyterlab_code_formatter:black",
"keys": [
"Ctrl S",
"Ctrl S"
],
"selector": ".jp-Notebook.jp-mod-editMode"
},