Skip to content

Instantly share code, notes, and snippets.

View adityasatrio's full-sized avatar
👻
I may be slow to respond.

Aditya satrio nugroho adityasatrio

👻
I may be slow to respond.
View GitHub Profile
@adityasatrio
adityasatrio / MySqlBackup.bat
Created July 1, 2015 04:02
Mysql Backup Script For Windows
@echo off
set dbUser=root
set dbPassword=password
set backupDir="F:\AdityaSatrioNugroho\testbackupDb-bat\"
set mysqldump="C:\xampp\mysql\bin\mysqldump.exe"
set mysqlDataDir="C:\xampp\mysql\data"
set zip="C:\Program Files\7-Zip\7z.exe"
:: get date
@adityasatrio
adityasatrio / git-switch
Created June 6, 2023 15:04
Git multiple account script
follow this tutorial until step 4 https://www.freecodecamp.org/news/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca/
bash script that implements the functionality you've requested. Save this as a file named git-switch and make sure to give it executable permissions (you can do this with chmod +x git-switch).
Please replace [PATH_TO_BROWSER] with your actual browser executable path, and replace https://www.freecodecamp.org/news/manage-multiple-github-accounts-the-ssh-way-2dadc30ccaca/ with the link you want to open when 'help' is invoked.
```
#!/bin/bash
function usage() {
echo "Possible commands:"
@adityasatrio
adityasatrio / gcp cheat sheet compute engine
Last active April 5, 2023 02:11
GCP cheat sheet instance compute engine type - sorted from lowest resource/cost
- f1-micro: This is a shared-core instance type that provides 0.2 vCPU and 0.6 GB of memory, and is designed for small workloads and development environments.
- g1-small: This is a first-generation instance type that provides a single shared vCPU and 1.7 GB of memory, and is slightly more powerful than f1-micro.
- e2-micro: This is a second-generation shared-core instance type that provides 0.25 vCPU and 1 GB of memory, and is a bit more powerful than g1-small.
- e2-small: This is a second-generation instance type that provides 2 vCPUs and 2 GB of memory, and is optimized for small workloads that require a balance of compute and memory resources.
- e2-medium: This is a second-generation instance type that provides 2 vCPUs and 4 GB of memory, and is a good option for workloads that require more memory than e2-small.
@adityasatrio
adityasatrio / TripleDesBouncyCastle.java
Last active February 1, 2021 07:21
Triple des bouncy castle.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package asn.helpers;
/**
*
* @author asn
*/
@adityasatrio
adityasatrio / EmailMessages.java
Last active February 19, 2018 12:42
Email using java email, velocity engine, spring
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.csl.cms.util.email;
import java.io.File;
import java.util.Map;
import org.springframework.core.io.InputStreamSource;
@adityasatrio
adityasatrio / Menu.java
Created August 19, 2014 13:15
Menu : parent and child menu, collapsing the child under the parent menu
package menu.test;
import java.io.Serializable;
import java.util.List;
public class Menu implements Serializable {
private Long id;
private Long parentid;
private String name;
private List<Menu> childMenu;
private void validateCheckSum(DocumentUploadRequest documentUploadRequest) {
long checksumValue = Utilities.checksum(documentUploadRequest.getDocument().getBytes());
long checksumReq = Long.parseLong(documentUploadRequest.getDocumentChecksum());
Logger.info("Checksum Document request " + checksumReq);
Logger.info("Checksum Document calculate " + checksumValue);
if (checksumReq != checksumValue) {
Logger.info("Checksum Document calculate " + checksumValue);
throw new ConstraintValidationException("Checksum vallidation failed");
}
}
@adityasatrio
adityasatrio / PasswordUtils.java
Created August 19, 2016 08:03 — forked from ToastShaman/PasswordUtils.java
A utility class for hashing passwords using PBKDF2 with BouncyCastle.
package com.zuhlke.lsapi;
import org.bouncycastle.crypto.PBEParametersGenerator;
import org.bouncycastle.crypto.digests.SHA3Digest;
import org.bouncycastle.crypto.generators.PKCS5S2ParametersGenerator;
import org.bouncycastle.crypto.params.KeyParameter;
import org.bouncycastle.crypto.prng.DigestRandomGenerator;
import java.util.Base64;
@adityasatrio
adityasatrio / eclipse-tools.txt
Created September 17, 2015 03:56
Tools eclipse for development
http://marketplace.eclipse.org/content/findbugs-eclipse-plugin/metrics
http://marketplace.eclipse.org/content/eclemma-java-code-coverage/metrics
http://eclipse-cs.sourceforge.net/#!/
@adityasatrio
adityasatrio / Resources for JAVA Interview
Last active August 29, 2015 14:26
Resources for JAVA Interview
https://gist.github.com/Nijjwal/4d4614f561e3e18b0f9a - java collection interview
https://gist.github.com/struts2spring/7694820 - java_interview_question1.md
https://gist.github.com/struts2spring/7687583 - Multi-Threading_interviewQuestion.txt
https://gist.github.com/pankaj2210/daadbe2515ad2e3d6cc3 Useful Resources for Java Interviews
http://tutorials.jenkov.com/java-collections/hashcode-equals.html
http://www.javaworld.com/article/2074996/hashcode-and-equals-method-in-java-object---a-pragmatic-concept.html
http://javarevisited.blogspot.com/2013/08/10-equals-and-hashcode-interview.html