Skip to content

Instantly share code, notes, and snippets.

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

Ending Hsiao Ending2015a

🏠
Working from home
  • NTHU Elsa lab
  • NTHU
View GitHub Profile
@Ending2015a
Ending2015a / hammersley.py
Last active July 8, 2020 09:23
This example shows the construction of 2D Hammersley sequence
import math
import matplotlib.pyplot as plt
def Phi(a, b):
sum = 0
base = 2
while(a > 0):
sum += (a%b)/base
base *= 2
a = a//b
@Ending2015a
Ending2015a / pm25.py
Last active August 24, 2020 12:10
This example shows how to use Python to retrieve PM2.5 data from the specific measuring station by using OpenData.epa API, and save them to CSV file
# --- built in ---
import os
import sys
import time
import json
import logging
import urllib.parse as urlparse
from typing import List
@Ending2015a
Ending2015a / pm25_gui.py
Last active August 30, 2020 09:28
PM2.5 GUI version
# --- built in ---
import os
import sys
import time
import json
import logging
import argparse
import threading
import urllib.parse as urlparse
@Ending2015a
Ending2015a / error_helper.h
Created September 12, 2020 06:22
CUDA (cuBLAS/cuSPARSE) error helper using meta programming
#ifndef __ERROR_HANDLER_CUH__
#define __ERROR_HANDLER_CUH__
#include <iostream>
#include <type_traits>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cusparse.h>
@Ending2015a
Ending2015a / video.py
Last active March 3, 2021 08:56
pybullet_envs save video
import gym
import numpy as np
import pybullet_envs
import subprocess as sp
VIDEO_WIDTH = 1280
VIDEO_HEIGHT = 720
VIDEO_FRAMERATE = 60
VIDEO_OUTPUT = 'output.mp4'
@Ending2015a
Ending2015a / scatter_2d.py
Last active January 21, 2022 09:50
Scatter N-D, TensorFlow 2.0 implementation, this function can be used for Active Neural SLAM to project depth maps to top-down height map
import tensorflow as tf
import numpy as np
def masked_scatter_nd_max(canvas, indices, values, mask=None):
'''
Scatters vector values with dim=v over an n-dim canvas,
For projecting to an image-type canvas, `dn` = `d2`, that is, the
@Ending2015a
Ending2015a / roman.cpp
Created June 18, 2021 15:29
Convert roman string to integer
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <string>
@Ending2015a
Ending2015a / roman.cpp
Created June 18, 2021 15:51
Convert roman to integer or integer to roman
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <string>
[2021-07-11 04:00:46|MainThread|WARNING|unstable_baselines.recil_lstmx2:train_recil.py:301]: ========================= Hyper Parameters =========================
[2021-07-11 04:00:46|MainThread|WARNING|unstable_baselines.recil_lstmx2:train_recil.py:301]: |------------------------------ ENV -------------------------------|
[2021-07-11 04:00:46|MainThread|WARNING|unstable_baselines.recil_lstmx2:train_recil.py:301]: | env_id: MineRLObtainDiamondVectorObf-v0 |
[2021-07-11 04:00:46|MainThread|WARNING|unstable_baselines.recil_lstmx2:train_recil.py:301]: | record_video: True |
[2021-07-11 04:00:46|MainThread|WARNING|unstable_baselines.recil_lstmx2:train_recil.py:301]: | monitor_dir: train/recil_lstmx2/monitor/ |
[2021-07-11 04:00:46|MainThread|WARNING|unstable_baselines.recil_lstmx2:train_recil.py:301]: | monitor: True |
[2021-07-11 04:00:46|MainThread|WARNING|unstable_bas
@Ending2015a
Ending2015a / show_datetime.py
Last active September 1, 2021 05:14
Python commonly used datetime format
import datetime
print(
datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
)
# '2021-09-01 13:09:06'