Skip to content

Instantly share code, notes, and snippets.

@coverboy
coverboy / current-year.jsp
Created March 12, 2025 22:19 — forked from NKjoep/current-year.jsp
print out the current year within a jsp
<%-- version1: java style --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="java.util.Date"%>
<%@page import="java.util.Calendar"%>
<% pageContext.setAttribute("currentYear", java.util.Calendar.getInstance().get(java.util.Calendar.YEAR)); %>
Current year is: <c:out value="${currentYear}" />
<%-- version2: JSTL style --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
@coverboy
coverboy / README.md
Created March 1, 2025 19:51 — forked from Tynael/README.md
How to use npx to run gist based scripts

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@coverboy
coverboy / netcat-pv.sh
Created February 17, 2025 10:00 — forked from hasantayyar/netcat-pv.sh
send files over netcat with progressbar
# sudo apt-get install pv
$ pv app.js | nc 192.168.1.123 10000
@coverboy
coverboy / jwt-expiration.md
Created April 10, 2022 01:12 — forked from soulmachine/jwt-expiration.md
How to deal with JWT expiration?

First of all, please note that token expiration and revoking are two different things.

  1. Expiration only happens for web apps, not for native mobile apps, because native apps never expire.
  2. Revoking only happens when (1) uses click the logout button on the website or native Apps;(2) users reset their passwords; (3) users revoke their tokens explicitly in the administration panel.

1. How to hadle JWT expiration

A JWT token that never expires is dangerous if the token is stolen then someone can always access the user's data.

Quoted from JWT RFC:

@coverboy
coverboy / gist:36bde6ad5a8c19d402dda8a4a5fa9674
Created February 5, 2022 14:36
javascript function execution time
const time_start = new Date().getTime();
// some function
const time_end = new Date().getTime();
console.log(`search elapsed time ==> ${(time_end - time_start) / 1000}s`);
@coverboy
coverboy / Dockerfile
Last active July 24, 2021 18:21
Jenkins as a Docker Container (Agent Role)
# Explanation : https://blog.1234.co.kr/2021/07/24/jenkins-as-a-docker-container-agent-role/
FROM ubuntu:20.04
# First off, replace ubuntu repository for fast download.
# Check the official ubuntu repository mirror site
# https://launchpad.net/ubuntu/+archivemirrors
RUN sed --in-place 's/archive.ubuntu.com/mirror.kakao.com/g' /etc/apt/sources.list
RUN apt update && apt upgrade -y
@coverboy
coverboy / formatter-annotation.java
Created February 16, 2021 01:44 — forked from vanpeerdevelopment/formatter-annotation.java
Example of the use of the @Formatter:off and @Formatter:on annotations in eclipse to disable formatting for a piece of code.
public class Formatter {
/**
* The next piece of code is not formatted
* because of the @formatter annotations.
*/
// @formatter:off
public void nonFormattedMethod() {
int sum = 1 + 2 + 3 + 4 + 5;
}
@coverboy
coverboy / reflect.py
Created January 23, 2021 09:32 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@coverboy
coverboy / LoggingController.java
Created September 6, 2020 02:56
spring boot logging level
log.trace("A Trace msg");
log.debug("A Debug msg");
log.info("An Info msg");
log.warn("A Warn msg");
log.error("An Error msg");