Skip to content

Instantly share code, notes, and snippets.

View jerry80409's full-sized avatar
:shipit:
harder better faster

jerry80409 jerry80409

:shipit:
harder better faster
View GitHub Profile
@jerry80409
jerry80409 / GPG and git on macOS.md
Created October 11, 2024 16:40 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@jerry80409
jerry80409 / FunctionalUtils.java
Created February 17, 2022 04:21 — forked from prskr/FunctionalUtils.java
Functional `try-with-resources`
import java.util.function.Supplier;
/**
* Utility class for functional extensions
*
* @author Peter Kurfer
*/
public abstract class FunctionalUtils {
private FunctionalUtils() {
@jerry80409
jerry80409 / git-deployment.md
Created September 2, 2021 03:30 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@jerry80409
jerry80409 / Table 欄位註解 comment 工具
Created June 28, 2021 01:47
Table 欄位註解 comment 工具
@Autowired
private EntityManager entityManager;
@SneakyThrows
@GetMapping("/comment")
@Transactional(noRollbackFor = SQLGrammarException.class)
public ResponseEntity<String> comment(@RequestParam(required = false) String className) {
final ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
provider.addIncludeFilter(new RegexPatternTypeFilter(Pattern.compile(".*")));
final Set<BeanDefinition> classes = provider.findCandidateComponents("tw.com.softleader.jasmine.policy.entity");
@jerry80409
jerry80409 / java8_stream_replace_file.java
Created November 19, 2019 02:09
java8_stream_replace_file
/**
* Ref: https://www.technicalkeeda.com/java-8-tutorials/java-8-stream-find-and-replace-file-content
*/
public static void main(String[] args) {
try {
Path path = Paths.get("c:\\demo.txt");
Stream <String> lines = Files.lines(path);
List <String> replaced = lines.map(line -> line.replaceAll("foo", "bar")).collect(Collectors.toList());
Files.write(path, replaced);
lines.close();
@jerry80409
jerry80409 / pg_helper.sh
Created October 2, 2019 04:18
An script help postgres database import and exoprt.
#!/usr/bin/env bash
#==============================
# An script help postgres database impoort and exoprt
#==============================
# an error occurred will stop script.
set -e
# an undefined parameter will throw error message.
set -u
@jerry80409
jerry80409 / ansicolor.sh
Created September 20, 2019 05:33
ASCI color code
#!/bin/bash
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
# Toturial: https://misc.flogisoft.com/bash/tip_colors_and_formatting#colors2
#Background
@jerry80409
jerry80409 / HelloWorld.java
Created July 26, 2016 18:27
Java HelloWorld
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
public class HelloWorld{
private static HelloWorld instance;
public static void main(String[] args){
instantiateHelloWorldMainClassAndRun();
@jerry80409
jerry80409 / Sublime Text Preferences
Last active June 24, 2016 16:08
Sublime Text Preferences
{
"default_encoding": "UTF-8",
"theme": "Fox.sublime-theme",
"color_scheme": "Packages/Theme - Fox/fox.dark.tmTheme",
"font_face": "Menlo",
"font_size": 14,
"highlight_line": true,
"highlight_modified_tabs": true,
@jerry80409
jerry80409 / socket_server.php
Created June 9, 2015 08:11
PHP Socket Server
<?php
#error_reporting(E_ALL); // 顯示 所有的錯誤、警告
set_time_limit(0); //最大執行時間:無限制
ob_implicit_flush(); //立即清空
socket_clear_error();
/*******************************************************************************