Skip to content

Instantly share code, notes, and snippets.

View jianhe-fun's full-sized avatar
🏠
Working from home

jianhe jianhe-fun

🏠
Working from home
View GitHub Profile
@jianhe-fun
jianhe-fun / WindowFunction
Last active December 13, 2021 12:10
WindowsFunction
select * from emp; -- show the whole table.
begin;
create table emp(empid int primary key, name text, department text, salary numeric);
insert into emp(empid, name, department, salary) values
(7,'Carol','Sales',4600.00),
(8,'sean','Sales',5600.00),
(1,'Cowen','Shipping',5400.00),
(2,'Tyler','Marketing',6300.00),
(5,'Charles','Sales',5400.00),
@jianhe-fun
jianhe-fun / index.html
Created August 15, 2021 16:27
gist for owner index html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1 style="text-align: center;" th:text="'List Of all Owner'">List of owner.</h1>
<table>
<thead>
@jianhe-fun
jianhe-fun / DataLoader.java
Created August 15, 2021 16:28
gist for dataloader
package jian.he.bootstrap;
import jian.he.model.Owner;
import jian.he.model.Vet;
import jian.he.services.OwnerService;
import jian.he.services.VetService;
import jian.he.services.map.OwnerServiceMap;
import jian.he.services.map.VetServiceMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
@jianhe-fun
jianhe-fun / OwnerController.java
Created August 15, 2021 16:29
Owner Controller Gist
package jian.he.controllers;
import jian.he.services.OwnerService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class OwnerController {
private final OwnerService ownerService;
package jian.he.recipe.services;
import jian.he.recipe.domain.Recipe;
import jian.he.recipe.repositroies.RecipeRepository;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.util.HashSet;
package jian.he.services.springdatajpa;
import jian.he.model.Owner;
import jian.he.repositories.OwnerRepository;
import jian.he.repositories.PetRepository;
import jian.he.repositories.PetTypeRepository;
import jian.he.services.OwnerService;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import java.util.HashSet;
package jian.he.recipe.services;
import jian.he.recipe.commands.IngredientCommand;
import jian.he.recipe.converters.IngredientCommandToIngredient;
import jian.he.recipe.converters.IngredientToIngredientCommand;
import jian.he.recipe.domain.Ingredient;
import jian.he.recipe.domain.Recipe;
import jian.he.recipe.repositroies.RecipeRepository;
import jian.he.recipe.repositroies.UnitOfMeasureRepository;
import lombok.extern.slf4j.Slf4j;
package jian.he.formatters;
import jian.he.model.PetType;
import jian.he.services.PetTypeService;
import org.springframework.format.Formatter;
import org.springframework.stereotype.Component;
import java.text.ParseException;
import java.util.Collection;
import java.util.Locale;
package jian.he.bootstrap;
import jian.he.model.*;
import jian.he.services.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
# https://pgbackrest.org/user-guide.html#introduction
#in psql.
show wal_level \; show archive_mode \; show max_wal_senders;
ALTER SYSTEM SET wal_level = replica;
ALTER SYSTEM SET archive_mode = on;
ALTER SYSTEM SET max_wal_senders = 3;
ALTER SYSTEM SET archive_command = 'pgbackrest --stanza=pgsql15_3 archive-push %p';
#check the cluster status.