Skip to content

Instantly share code, notes, and snippets.

View tyagiakhilesh's full-sized avatar

Akhilesh Tyagi tyagiakhilesh

  • Bangalore, India
View GitHub Profile
@tyagiakhilesh
tyagiakhilesh / set-locale-in-debian.md
Created January 24, 2020 12:36
setting-locale-debian

sudo vim /etc/default/locale

Set below entries in above file.

LC_CTYPE=en_US.UTF-8 LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

sudo dpkg-reconfigure locales sudo shutdown -r now

@tyagiakhilesh
tyagiakhilesh / journalctl.md
Last active January 9, 2021 23:32
Using JournalCtl to view system logs
// To display utc timestamp in logs
journalctl --utc

// Displaying Logs from the Current Boot
journalctl -b

// Listing boots
journalctl --list-boots
@tyagiakhilesh
tyagiakhilesh / delete-all-indices-from-es.sh
Last active January 20, 2020 17:08
Delete All indices from elastic search.
#!/bin/bash
(curl -s -XGET 'http://10.160.0.37:9200/_cat/indices/?pretty' ) | awk '{print $3}' | egrep 'stage*|.kibana'| while read -r line; do curl -XDELETE http://10.160.0.37:9200/"${line}";done
@tyagiakhilesh
tyagiakhilesh / delete-all-indices-from-es.sh
Created January 20, 2020 17:08
Delete All indices from elastic search.
#!/bin/bash
(curl -s -XGET 'http://10.160.0.37:9200/_cat/indices/?pretty' ) | awk '{print $3}' | egrep 'stage*|.kibana'| while read -r line; do curl -XDELETE http://10.160.0.37:9200/"${line}";done
@tyagiakhilesh
tyagiakhilesh / mount-raw-disk-on-centos.md
Created December 27, 2019 10:24
Mount a new disk on centos

Check the current disks and what exists on them.

lsblk
sudo lshw -class disk

Create partition on disk

fdisk /dev/sdb

@tyagiakhilesh
tyagiakhilesh / curl-and-spring-security.md
Created December 9, 2019 12:32
Login to spring security app via curl.
@tyagiakhilesh
tyagiakhilesh / mvn-release-steps.md
Last active December 8, 2022 09:09
Maven artifcact release steps
  1. Add section to your pom with option specified.
  2. Add maven release plugin to your pom.
  3. mvn -B release:prepare -Dtag=relv2.0.6
  4. mvn release:perform -Darguments="-Dmaven.javadoc.skip=true"

In above, last step : recently faced the issue that peform was getting stuck on checkout in target/checkout directory. So I followed this advise here

Setting the version:

@tyagiakhilesh
tyagiakhilesh / LoadDataInMySQLInTestContainers.java
Created November 25, 2019 07:39
Loading data in mysql container managed by testconatiners.
import my.personal.package.LiquibaseRunner;
import org.apache.commons.dbcp.BasicDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.Container.ExecResult;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
@tyagiakhilesh
tyagiakhilesh / liquibase-run-cli.md
Last active July 6, 2022 16:29
Running liquibase to do various tasks like generate changelog and what not.
  • Download liquibase archive file
  • Extract it
  • Create liquibase.properties file like below and put it in LIQUIBASE_HOME
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3320/test
username=<user>
password=<pass>
changeLogFile=changelog-test.xml
#!/bin/bash
set -x
mvn_cmd_to_get_version() {
mvn help:evaluate -Dexpression=project.version
}
get_current_version() {
output=$(mvn_cmd_to_get_version);
result=$(echo "$output" | grep -v '\[.*');
echo $result