Skip to content

Instantly share code, notes, and snippets.

@fanurs
fanurs / reinstall-vscode.sh
Last active February 5, 2025 02:21
How to reinstall VS Code remotely
# When to reinstall?
# - When VS Code cannot connect to remote server via the SSH extension
# - New extensions cannot be installed on remote server
# 1. Connect to remote server (without using VS Code, of course).
# 2. Remove the ~/.vscode-server directory
cd ~
rm -rf .vscode-server/
@alper111
alper111 / vgg_perceptual_loss.py
Last active April 8, 2025 08:10
PyTorch implementation of VGG perceptual loss
import torch
import torchvision
class VGGPerceptualLoss(torch.nn.Module):
def __init__(self, resize=True):
super(VGGPerceptualLoss, self).__init__()
blocks = []
blocks.append(torchvision.models.vgg16(pretrained=True).features[:4].eval())
blocks.append(torchvision.models.vgg16(pretrained=True).features[4:9].eval())
blocks.append(torchvision.models.vgg16(pretrained=True).features[9:16].eval())