Skip to content

Instantly share code, notes, and snippets.

View raytroop's full-sized avatar
🎯
Focusing

raytroop

🎯
Focusing
View GitHub Profile
@raytroop
raytroop / hook_pth.py
Last active February 10, 2024 06:32
try hook of pytorch
import torch
from torch import nn
# 1.
# register_forward_pre_hook(hook)
# The hook will be called every time before forward() is invoked. It should have the following signature:
# `hook(module, input) -> None`
# The hook should not modify the input
@raytroop
raytroop / MatMulTiled.cu
Created October 23, 2019 09:43
Matrix Multiplication in CUDA using Shared memory
#include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
//http://www.techdarting.com/2014/03/matrix-multiplication-in-cuda-using.html
// This code assumes that your device support block size of 1024
#define MAX_RANGE 9999
@raytroop
raytroop / install.sh
Last active February 7, 2022 15:45
compile vim from source with GUI support
# gtk3 in Rocky Linux 8.5
./configure --with-features=huge --enable-gui=gtk3 --enable-python3interp --prefix=/usr
make -j`nproc`
sudo make install
@raytroop
raytroop / tf_gradient_clip_lr_decay.py
Created September 2, 2018 08:31 — forked from InnerPeace-Wu/tf_gradient_clip_lr_decay.py
ways to do gradients clipping and learning rate decay in tensorflow
import tensorflow as tf
#aplly exponential decay on learning rate
global_step = tf.Variable(0, trainable=False)
stater_learning_rate = lr #for start
learning_rate = tf.train.exponential_decay(starter_learning_rate, global_step,
decay_steps, decay_rate, staircase=True)
optimizer = tf.train.AdamOptimizer(learning_rate)
@raytroop
raytroop / rpm
Last active December 24, 2021 14:16
Rocky Linux 8 rpm for cadence binary and cdnshelp
sudo yum install openssl compat-openssl10 qca-qt5-ossl.x86_64 openssl-devel
@raytroop
raytroop / RockyLinux8.txt
Last active December 7, 2021 16:10
Rocky Linux 8 extend LVM in VMware
1) gparted extend
2)
lvextend -l +100%FREE /dev/rl/root
3)
xfs_growfs /dev/mapper/rl-root
usefull command:
df -h
lvdisplay
fdisk -l
@raytroop
raytroop / SBR.m
Created November 26, 2021 01:14
SBR ref. Fast and Accurate Estimation of Statistical Eye Diagram for Nonlinear High-Speed Links
A = zeros(10,21);
n = [1:10];
% post cursor
for m = 1:3
A(m, 11+n(m)) = 0.5;
A(m, 11-n(m)) = 0.5;
end
% one
@raytroop
raytroop / README.txt
Last active October 15, 2021 18:58
vimscript memo
a: -> variable scope
s: -> current script’s namespace
b: -> local to the current buffer
@raytroop
raytroop / README.txt
Created October 14, 2021 14:55
jump through placerhold of coc.nvim
g:coc_snippet_next g:coc_snippet_next
Trigger key for going to the next snippet position, applied in insert
and select mode.
Only works when snippet session is activated.
Default: <C-j>
g:coc_snippet_prev g:coc_snippet_prev
@raytroop
raytroop / install.sh
Created October 13, 2021 17:37
npm install local package
git clone https://github.com/raytroop/svlangserver.git
cd svlangserver/
npm pack
npm install -g imc-trading-svlangserver-0.3.4.tgz