Skip to content

Instantly share code, notes, and snippets.

View hungbang's full-sized avatar
🏠
Working from home

Harry B. hungbang

🏠
Working from home
View GitHub Profile
@hungbang
hungbang / jenkins-create-node.sh
Created September 19, 2022 03:41 — forked from sergeyhush/jenkins-create-node.sh
Jenkins create new node
#!/bin/bash
JENKINS_URL=$1
NODE_NAME=$2
NODE_SLAVE_HOME='/home/build/slave'
EXECUTORS=1
SSH_PORT=22
CRED_ID=$3
LABELS=build
USERID=${USER}
@hungbang
hungbang / *scratch*.txt
Created August 25, 2022 01:54 — forked from aculich/*scratch*.txt
Downgrade helm client
# How to downgrade helm version on server and client
# https://medium.com/@jyotirbhandari/how-to-downgrade-helm-version-on-server-and-client-4838ca100dbf
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash -s -- --version v2.16.9
# ===================================================================
# COMMON SPRING BOOT PROPERTIES
#
# This sample file is provided as a guideline. Do NOT copy it in its
# entirety to your own application. ^^^
# ===================================================================
# ----------------------------------------
# CORE PROPERTIES
# ----------------------------------------
@hungbang
hungbang / atomikos_jms.java
Created February 28, 2022 07:15 — forked from tyb/atomikos_jms.java
Spring Boot JTA Atomikos & JMS configuration
package com.xxx.common.config;
import com.atomikos.icatch.config.UserTransactionServiceImp;
import com.atomikos.icatch.jta.UserTransactionImp;
import com.atomikos.icatch.jta.UserTransactionManager;
import net.sf.ehcache.transaction.manager.TransactionManagerLookup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

PSQL CLI Client

Psql is a fully-fledged CLI client for Postgres, but most people are unaware of its many advanced features.

~/.psqlrc can be edited to persist any behavior or configuration settings you want between psql sessions. It behaves just like ~/.bashrc or ~/.vimrc, sourced at psql launch. See More out of psql for some interesting configurations.

If you have a long query to write and rewrite, you can use \e to edit your query in an editor.

Use \watch at the end of a query in order to automatically re-run the query every few seconds - great for monitoring while making changes elsewhere in your application architecture.

@hungbang
hungbang / DockerCleanupScripts.md
Created August 2, 2021 03:21 — forked from johnpapa/DockerCleanupScripts.md
Docker Cleanup Scripts

Docker - How to cleanup (unused) resources

Cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@hungbang
hungbang / Unique.java
Created June 10, 2021 16:24 — forked from Bharathbrothers/Unique.java
How to generate unique random numbers in Java?
ArrayList<Integer> array = new ArrayList<>(4);
ArrayList<Integer> input = new ArrayList<>(4);
for(int i=0;i<10;i++){
array.add(i);
}
Collections.shuffle(array);
for(int j=0;j<4;j++){
input.add(array.get(j));
#!/usr/bin/env bash
echo "
----------------------
MONGODB
----------------------
"
# import mongodb 4.0 public gpg key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
@hungbang
hungbang / 0main.md
Created June 2, 2021 07:26 — forked from pandeiro/0main.md
Git Best Practices

Git Best Practices

This is a fairly common question, and there isn't a One True Answer, but still, this represents a consensus from #git

Read about git

Knowing where to look is half the battle. I strongly urge everyone to read (and support) the Pro Git book. The other resources are highly

@hungbang
hungbang / index.js
Created May 23, 2021 08:00 — forked from kennyhyun/index.js
lamda thumbnail generator
// dependencies
var async = require('async');
var AWS = require('aws-sdk');
// Enable ImageMagick integration.
var gm = require('gm').subClass({ imageMagick: true });
var util = require('util');
var pdf2png = require('pdf2png');
pdf2png.ghostscriptPath = "/usr/bin";
// constants