Skip to content

Instantly share code, notes, and snippets.

Avatar
😌
Ready for the next challenge

Jolyon jolyon129

😌
Ready for the next challenge
View GitHub Profile
@jolyon129
jolyon129 / RequestAndResponseLoggingFilter.java
Last active Aug 10, 2020 — forked from int128/RequestAndResponseLoggingFilter.java
Spring Web filter for logging request and response
View RequestAndResponseLoggingFilter.java
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
@jolyon129
jolyon129 / vim-diff-against-saved-file.md
Created Apr 8, 2020 — forked from dergachev/vim-diff-against-saved-file.md
VIM snippet to show diff of unsaved changes.
View vim-diff-against-saved-file.md

Let's say you're editing a file in VIM, and want to see a diff between your current unsaved version and what's on the hard disk. Turns out you can just type this:

:w !git diff --no-index % -

What this does it pipes the whole contents of the current file to the command git diff --no-index % - The % symbol is substituted by vim to be the path to the saved file. The - tells git diff to read from STDIN.

@jolyon129
jolyon129 / center.css
Created Apr 1, 2020
The Ultimate Centering in CSS
View center.css
/*
https://twitter.com/jacobmparis/status/1245193222181326848?s=21
*/
.center{
text-align: center;
align-items: center;
align-content: center;
justify-content: center;
justify-self: center;
justify-items: center;
@jolyon129
jolyon129 / iterm2-solarized.md
Created Mar 27, 2020 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel10k

Powerlevel10k

@jolyon129
jolyon129 / bulk-delete-weibo.js
Last active Mar 7, 2020
Automate bulk delete weibo though web weibo. 批量删除微博
View bulk-delete-weibo.js
/*
Sign in to weibo webside.
Click on your home page.
Paste the following code into the console and enter.
*/
'use strict';
var s = document.createElement('script');
@jolyon129
jolyon129 / k_fold_roc_plot.py
Created Feb 28, 2020
Draw k-fold roc curves for multiple classifiers and plot them in the same figure
View k_fold_roc_plot.py
import matplotlib.pyplot as plt
import numpy as np
from numpy import interp
from sklearn import metrics
from sklearn.metrics import precision_recall_fscore_support
from sklearn.model_selection import KFold
def k_fold_roc_plot(cls, Xs, y, verbose=False):
""" Plot 10-fold Mean ROC
@jolyon129
jolyon129 / train_valid_split.py
Created Jan 31, 2019 — forked from sariabod/train_valid_split.py
Break up training set into train/valid splits.
View train_valid_split.py
import pandas as pd
import pathlib
import sys
import uuid
import shutil
df = pd.read_csv('data/train.csv')
f = open("data/labels.csv","a")
@jolyon129
jolyon129 / dabblet.css
Last active Aug 29, 2015 — forked from LeaVerou/dabblet.css
Move in a circle without wrapper elements
View dabblet.css
/**
* Move in a circle without wrapper elements
* Idea by Aryeh Gregor, simplified by Lea Verou
*/
@keyframes rot {
from {
transform: rotate(0deg)
translate(-150px)
rotate(0deg);