Skip to content

Instantly share code, notes, and snippets.

View samueljackson92's full-sized avatar

Samuel Jackson samueljackson92

  • UKAEA
  • Wallingford, Oxfordshire, UK
View GitHub Profile
@alper111
alper111 / vgg_perceptual_loss.py
Last active August 31, 2024 09:02
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())
@ericclemmons
ericclemmons / example.md
Last active September 20, 2024 12:46
HTML5 <details> in GitHub

Using <details> in GitHub

Suppose you're opening an issue and there's a lot noisey logs that may be useful.

Rather than wrecking readability, wrap it in a <details> tag!

<details>
 Summary Goes Here
@cgddrd
cgddrd / syntaxlistingformat.tex
Created March 12, 2013 16:59
Syntax highlighting and formatting for source code listings in LaTeX.
\lstdefinestyle{customc++}{
belowcaptionskip=1\baselineskip,
breaklines=true,
frame=L,
language=C++,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{OliveGreen},
commentstyle=\itshape\color{black},
identifierstyle=\color{blue},
@vitormil
vitormil / gist:4364864
Last active May 27, 2022 18:20
partially disable the zsh's autocorrect feature

the problem:

subl somefile
zsh: correct 'subl' to 'ul' [nyae]? n

node -v
zsh: correct 'node' to 'od' [nyae]? n
v0.8.16
@adobkin
adobkin / FindCUnit.cmake
Created July 9, 2011 05:28
Module for CMake to search the CUnit headers and libraries
# Find the CUnit headers and libraries
#
# CUNIT_INCLUDE_DIRS - The CUnit include directory (directory where CUnit/CUnit.h was found)
# CUNIT_LIBRARIES - The libraries needed to use CUnit
# CUNIT_FOUND - True if CUnit found in system
FIND_PATH(CUNIT_INCLUDE_DIR NAMES CUnit/CUnit.h)
MARK_AS_ADVANCED(CUNIT_INCLUDE_DIR)
@endolith
endolith / peakdet.m
Last active July 27, 2024 19:48
Peak detection in Python [Eli Billauer]
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.