Skip to content

Instantly share code, notes, and snippets.

@danishi
danishi / SelectCase.bat
Created March 19, 2022 14:47
CASE expression in a batch file
@echo off
set Case=?
set /p Case=?
:Select
goto Case%Case%
:Case1
echo case1
/*
Display Custom Characters on 16×2 LCD
For more details, visit: https://techzeero.com/arduino-tutorials/custom-characters-on-16x2-lcd/
*/
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
byte smile[8] = {0b00000,0b01010,0b00000,0b00000,0b10001,0b01110,0b00000,0b00000};
@Hakky54
Hakky54 / java_keytool_cheat_sheet.md
Last active May 2, 2025 10:15
Keytool Cheat Sheet

Keytool CheatSheet 🔐

Some history

This cheat sheet came into life when I started working on a tutorial of setting up one way tls and two way tls, which can be found here: GitHub - Mutual TLS SSL

Creation and importing

Generate a Java keystore and key pair

keytool -genkeypair -keyalg RSA -keysize 2048 -keystore keystore.jks -alias server -validity 3650
@seanh
seanh / vimgrep.md
Last active April 27, 2025 13:31
vimgrep cheatsheet

vimgrep

  • Vimcasts on vimgrep

  • Uses native vim regexes (which are slightly different from the regexes used by grep, ack, ag, etc) so the patterns are the same as with vim's within-file search patterns.

You can do a normal within-file search first, then re-use the same pattern to

@jlaine
jlaine / pagination-page.ts
Last active November 2, 2020 09:35
Angular pagination - page
export class Page<T> {
count: number; // total number of items
next: string; // URL of the next page
previous: string; // URL of the previous page
results: Array<T>; // items for the current page
}
@mobynote
mobynote / DemoRepository
Created March 7, 2018 03:17
Use jdbcTemplate implement a pagination in spring
package com.domain;
import com.domain.Module;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
@MgenGlder
MgenGlder / map.js
Last active December 18, 2020 03:14
Convert map to http params
mapToHttpParams(params)
function mapToHttpParams (m : Map) : String {
let s = "";
if (!empty(m)) {
for(let key in m) {
let value = m[key];
if (!empty(value)) {
s = StringUtils.format("{0}{1}{2}={3}",
s,
(s.length != 0) ? "&":"",
@felipeochoa
felipeochoa / comment-form.js
Created April 7, 2017 16:35
@-mentions for Quill
const quillModules = {
toolbar: ["bold", "italic", "underline", "strike"],
// mentions is added in constructor
keyboard: {
bindings: {
tab: {
key: 9,
handler: function(range, context) {
return this.quill.mentionHandler(range.context);
}
@liufuyang
liufuyang / tailc
Last active August 11, 2024 00:48
Color output of linux tail command
#!/bin/bash
# save this file as tailc then
# run as: $ tailc logs/supplier-matching-worker.log Words_to_highlight
file=$1
if [[ -n "$2" ]]; then
color='
// {print "\033[37m" $0 "\033[39m"}
/(WARN|WARNING)/ {print "\033[1;33m" $0 "\033[0m"}
/(ERROR|CRIT)/ {print "\033[1;31m" $0 "\033[0m"}
@todgru
todgru / gist:48b1482e64d1318a4dc429545ace43ce
Created February 23, 2017 18:38 — forked from ilguzin/gist:6606011
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file: