Skip to content

Instantly share code, notes, and snippets.

@icehongssii
icehongssii / aws_ssm_get_parameter.md
Created March 3, 2022 07:21 — forked from ruanbekker/aws_ssm_get_parameter.md
Getting Secrets from SSM using GetParameter Example with Python and Boto3

Bash Environment Example with SSM to get Parameter Values using GetParameter:

IAM Policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Stmt1517398919242",
@icehongssii
icehongssii / linear_regression_tf.py
Last active March 15, 2019 05:54
testing linear regression for deep learning
import tensorflow as tf
x_train = [1,2,3]
y_train = [1,2,3]
# H(x) = Wx+b
W = tf.Variable(tf.random_normal([1]), name="weight")
b = tf.Variable(tf.random_normal([1]), name="bias")
import websocket
import requests
import json
# 중요한 값은 상수사용합니다.
SYMBOL_LIST_ENDPOINT = "https://www.bitmex.com/api/v1/instrument/active"
ENDPOINT = 'wss://www.bitmex.com/realtime'
def sendRequest(url):
res = requests.get(url)
import requests
import json
def sendRequest(url):
res = requests.get(url)
contents = res.content.decode('utf-8')
# python2에서는 contents = res.content만 적어도 됩니다.
# python2에서는 res.content가 string으로 오지만
# python3에서는 byte로 오기 때문에 디코딩이 필요합니다.
import requests
import json
def sendRequest(url):
res = requests.get(url)
contents = res.content.decode('utf-8')
# python2에서는 contents = res.content만 적어도 됩니다.
# python2에서는 res.content가 string으로 오지만
# python3에서는 byte로 오기 때문에 디코딩이 필요합니다.
import websocket
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
# PRECISION = "s"
# MEASUREMENT = "candlesticks"
# EXCHANGE = "bitmex"
#
# SUBSCRIPTION_DICT = {"op":"subscribe", "args":'tradeBin1m:{}'}
# PAIR_URL = "https://www.bitmex.com/api/v1/instrument/active"
# WEBSOCK_URL = "wss://www.bitmex.com/realtime?subscribe=tradeBin1m:XBTUSD"
# TYPE = "SPOT"
import websocket
async function f() {
let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), 1000)
});
let result = await promise; // wait till the promise resolves (*)
alert(result); // "done!"
}
loadScript('first.js', function(err,script){
if(err){
//error handling
//fail to load 1st script
}else{
loadScript('second.js', function(err,script){
if(err){
//error handling
//fail to load 2nd script
}else{
function loadScript(src) {
let script = document.createElement('script');
script.src = src;
document.head.append(script);
}