Skip to content

Instantly share code, notes, and snippets.

View exaucae's full-sized avatar

Chrys Exaucet exaucae

View GitHub Profile
@exaucae
exaucae / .env
Created October 28, 2021 20:00
traccar docker setup
MYSQL_ROOT_PASSWORD=traccar
MYSQL_ROOT_HOST='%'
MYSQL_DATABASE=traccar
MYSQL_USER=traccar
MYSQL_PASSWORD=traccar
@exaucae
exaucae / .gitmodules-rm.md
Last active November 22, 2021 09:03
average to advanced git commands
  1. Delete the relevant section from the .gitmodules file. 2.Stage the .gitmodules changes: git add .gitmodules
  2. Delete the relevant section from .git/config.
  3. Remove the submodule files from the working tree and index: git rm --cached path_to_submodule (no trailing slash).
  4. Remove the submodule's .git directory: rm -rf .git/modules/path_to_submodule
  5. Commit the changes: git commit -m "Removed submodule "
  6. Delete the now untracked submodule files: rm -rf path_to_submodule

Ref: https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule

@exaucae
exaucae / usePosition.js
Created November 9, 2021 22:53
React hook that retrieves current user position
import React, {useState} from 'react'
const useLocation = () => {
const initialState = {
latitude: '',
longitude: '',
error: '',
@exaucae
exaucae / kill-process.txt
Last active October 27, 2021 12:50
scripting utils
Windows
=======
1. netstat -ano | findstr < Port Number >
Example: netstat -ano | findstr 8080
2. taskkill /F /PID < Process Id >
Example: taskkill /F /PID 25392
@exaucae
exaucae / AbstractWebSocketClientAdapter.java
Created September 28, 2021 00:37
Websocket over Stomp Java client config
package client.websocket.adapter.parent;
import com.google.gwt.user.client.Window;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.messaging.simp.stomp.StompCommand;
import org.springframework.messaging.simp.stomp.StompHeaders;
import org.springframework.messaging.simp.stomp.StompSession;
import org.springframework.messaging.simp.stomp.StompSessionHandlerAdapter;
@exaucae
exaucae / k8s-memo
Last active September 15, 2021 14:45
kubernetes special tricks
# add ingress controller with minikube
minikube addons enable ingress
# verify it
kubectl get pods -n ingress-nginx \
-l app.kubernetes.io/name=ingress-nginx --watch
@exaucae
exaucae / react-router.md
Last active September 15, 2021 14:43
React unit testing tricks
// Unit testing react-router 

// pay attention to write it at your test file top level
const mockedUsedNavigate = jest.fn();

jest.mock('react-router-dom', () => ({
   ...jest.requireActual('react-router-dom') as any,
 useNavigate: () =&gt; mockedUsedNavigate,
@exaucae
exaucae / pgR2dbcConfig.java
Created August 31, 2021 14:31
postgres springboot reactive config for r2dbc
package your.pkg;
import io.r2dbc.postgresql.PostgresqlConnectionConfiguration;
import io.r2dbc.postgresql.PostgresqlConnectionFactory;
import io.r2dbc.spi.ConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration;
import org.springframework.data.r2dbc.core.DefaultReactiveDataAccessStrategy;
@exaucae
exaucae / docker-compose.yml
Last active August 31, 2021 14:26
compose file for keycloack
version: '3.4'
networks:
keycloak-network:
driver: bridge
services:
postgres:
container_name: keycloak-db
image: postgres:latest
@exaucae
exaucae / mvn-uber-jar-plugins.xml
Created August 31, 2021 14:23
maven plugins to fat jar your project
<!-- https://stackoverflow.com/questions/20801874/how-to-build-an-executable-jar-from-multi-module-maven-project/20802018#20802018 -->
<!-- https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven?page=1&tab=votes#tab-top -->
<build>
<plugins>
<!-- mvn package -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>