Skip to content

Instantly share code, notes, and snippets.

View elcolie's full-sized avatar

El 李天宝 elcolie

View GitHub Profile
@elcolie
elcolie / nvidia_gpu_chk.py
Created July 17, 2023 04:28
Check CUDA GPU
import torch
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
print()
#Additional Info when using cuda
if device.type == 'cuda':
print(torch.cuda.get_device_name(0))
print('Memory Usage:')
print('Allocated:', round(torch.cuda.memory_allocated(0)/1024**3,1), 'GB')
@elcolie
elcolie / set_seed.py
Created May 30, 2023 03:18
Set all seed for python
import random
import torch
import numpy as np
def seed_everything(seed: int):
random.seed(seed)
os.environ['PYTHONHASHSEED'] = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
if torch.cuda.is_available():
@elcolie
elcolie / timeseries.csv
Created February 2, 2023 10:37
predicted_signal, solution
x sol
-12.1748046875 0
11.991466522216797 0
-12.00814437866211 0
11.986132621765137 0
-12.007420539855957 0
12.002096176147461 0
12.192679405212402 0
12.278199195861816 0
-12.004239082336426 0
@elcolie
elcolie / survey_10th.csv
Created June 8, 2022 07:09
CO2 analysis
trcr_time_stamp trcr_co2_conc_pct predicted_label
2019-03-13 09:51:20 0.4621884093538548 0.0
2019-03-13 09:51:30 0.48048942958314345 0.0
2019-03-13 09:51:40 0.5470032574779469 0.0
2019-03-13 09:51:41 0.553655402428856 0.0
2019-03-13 09:51:50 0.6097581052057149 0.0
2019-03-13 09:52:00 0.5908580260933587 0.0
2019-03-13 09:52:10 0.49999009190142507 0.0
2019-03-13 09:52:20 0.48048942958314345 0.0
2019-03-13 09:52:30 0.44938104870363965 9.0
time amplitude
0 0.000096
0.001 0.000134
0.002 0.000108
0.003 0.000112
0.004 0.000115
0.005 0.00014
0.006 0.000144
0.007 0.000126
0.008 0.000108
@elcolie
elcolie / question.csv
Created May 6, 2021 06:03
Sample question for stackoverflow
0
0 68.86199951171875
1 68.77896118164062
2 68.7582015991211
3 68.7533187866211
4 68.7520980834961
5 68.59825897216797
6 68.55979919433594
7 68.69412231445312
8 68.72769927978516
@elcolie
elcolie / load_well.txt
Created March 8, 2021 03:03
Load well GraphQL query
Load well
query solution
http://zbumper:8011/gql/
mutation load_well {
cmd_load_well_from_tao2db(
well: {
opru_fld_nme: "EXAMPLE"
prod_govt_lse_nbr: "A"
well_nbr: "A1"
@elcolie
elcolie / .pre-commit-config.yaml
Created March 5, 2021 08:20
winglue pre-commit
default_language_version:
python: python
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.0
hooks:
- id: trailing-whitespace
types: [python]
- id: end-of-file-fixer
types: [python]
from django.db import connection, reset_queries
import time
import functools
def query_debugger(func):
@functools.wraps(func)
def inner_func(*args, **kwargs):
reset_queries()
@elcolie
elcolie / red_pill.txt
Last active April 1, 2020 03:00
Unplug myself from evil OS to freedom OS
# Unfortunately I am still working with `blob`
====================================
PyCharm
LINE on chrome
MS team on Linux
Slack or use web
WhatsApp or use web
zoom feature in Gnome3 https://unix.stackexchange.com/questions/33243/does-gnome-3-support-desktop-zoom