Skip to content

Instantly share code, notes, and snippets.

View delphym's full-sized avatar
🏠
Transforming existing jobs to Jenkins Pipelines

DelphyM delphym

🏠
Transforming existing jobs to Jenkins Pipelines
  • Christchurch, NZ
  • 00:58 (UTC -12:00)
View GitHub Profile
@delphym
delphym / JpaToSQL.java
Last active October 26, 2023 02:14
JPA to NATIVE SQL
import javax.persistance.TypedQuery;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory;
import org.hibernate.hql.spi.QueryTranslator;
public class JpaToSQL {
TypedQuery<T> query = null;
public static void main(String[] args) {
@delphym
delphym / RequestHandler.java
Last active May 9, 2023 03:43
Lambda Expressions with Streams magics
@Component
@Scope("prototype")
public class RequestHandler extends BaseRequestHandler<List<PositionEstablishment>> {
@Autowired
private PositionEstablishmentRepository positionEstablishmentRepository;
Date asAtDate;
private List<com.jemini.base.model.position.PositionEstablishment> establishments = new ArrayList<>();
private List<PositionDateEffective> positionDateEffectives;
public Date getAsAtDate() {return asAtDate;}
@delphym
delphym / install-zsh-windows-git-bash.md
Last active November 30, 2023 23:36 — forked from fworks/install-zsh-windows-git-bash.md
Zsh / Oh-my-zsh on Windows Git Bash
@delphym
delphym / DBquerryAsListTest.java
Created February 9, 2022 03:10
To demonstrate how to run simple SELECT statement and get result back as a list of defined object models.
@SpringBootTest
class DBquerryAsListTest {
@Autowired
@Qualifier("testSetupDataSource")
DataSource testSetupDataSource;
JdbcTemplate jdbcTemplate;
@Test
@delphym
delphym / DAOTests.java
Last active February 2, 2022 01:50
HOWTO execute CREATE PROCEDURE statement (from a file or String) in Spring Boot FW
// import(s) are omitted
@SpringBootTest
@Log4J2
class DAOTests {
JdbcTemplate jdbcTemplate;
@Autowired DataSource testSetupDataSource;
@BeforeEach
void setup1() throws SQLException { //using Java String & JdbcTemplate
jdbcTemplate = new JdbcTemplate(testSetupDataSource);
@delphym
delphym / openvpn.sh
Last active September 13, 2021 04:12
Control openVPN client
#!/bin/bash
# https://www.aandcp.com/launchdaemons-and-mac-os-x-openvpn-as-an-example
### FURTHER TUNNELING ############################
# You can enable unreachable URLs by
# Pick the host from the URI you can't reach and find its IPs by running, e.g.
# dig vw-bellhop.test.bussys.trimble.com +noall +answer
# Then followed by for each IP address, add the route
# sudo route add 44.236.79.253/32 -interface utun0
#
@delphym
delphym / compress-pdf-with-gs.md
Created June 3, 2021 09:52 — forked from guifromrio/compress-pdf-with-gs.md
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@delphym
delphym / BSG_reposUpdate.sh
Last active July 29, 2021 02:15
GIT Repos update and bulk checkout
#!/bin/bash
changed=`tempfile -p changed -s .txt` # For macOs, see: https://stackoverflow.com/q/19408005/2234369
nochanges=`tempfile -p nochanges -s .txt`
updated=`tempfile -p updated -s .txt`
cantupd=`tempfile -p cantupd -s .txt`
notonAKAdev=`tempfile -p notonAKAdev -s .txt`
switchedto=`tempfile -p switchedto -s .txt`
failedtoswitch=`tempfile -p failedtoswitch -s .txt`
# Setting default values
@delphym
delphym / Jenkins+Script+Console.md
Created April 1, 2020 20:18 — forked from mubbashir/Jenkins+Script+Console.md
jenkins groovy scripts collection.
@delphym
delphym / fix-git-line-endings
Last active September 12, 2019 01:26 — forked from ajdruff/fix-git-line-endings
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF