Skip to content

Instantly share code, notes, and snippets.

View fariswd's full-sized avatar

Faris Widyantho fariswd

View GitHub Profile
# Load version control information
autoload -Uz git_branch_test_color
git_branch_test_color() {
local ref=$(git symbolic-ref --short HEAD 2> /dev/null)
if [ -n "${ref}" ]; then
local gitstatuscolor='%F{yellow}'
echo "%B${gitstatuscolor} (${ref})%b"
else
echo ""
fi
Setup remote ssh with host alias
1. create RSA pair local /use existing
2. cat _pub - copy
3. access remote ssh using password/VNC
4. vi ~/.ssh/authorized_keys
5. paste _pub
6. exit
7. vi ~/.ssh/config
8. setup Host, HostName, User, IdentityFile
@fariswd
fariswd / x-tt-token.js
Created September 19, 2022 09:50
x-tt-token
const CryptoJS = require("crypto-js");
const decrypt = (input) => {
const key = CryptoJS.enc.Utf8.parse("webapp1.0+202106");
const ciphertext = CryptoJS.enc.Base64.parse(input);
const encryptedCP = CryptoJS.lib.CipherParams.create({
ciphertext: ciphertext,
});
const decryptedWA = CryptoJS.AES.decrypt(encryptedCP, key, { iv: key });
const decryptedUtf8 = decryptedWA.toString(CryptoJS.enc.Utf8);
@fariswd
fariswd / simpletoken.js
Created November 21, 2021 11:12
simpletoken.js
const encodeToken = () => {
const dateTime = (new Date()).getTime()
const calculateTime = dateTime*5
const encodedStringBtoA = btoa(calculateTime);
return encodedStringBtoA
}
const decodeToken = (encodedStringBtoA) => {
const decodedStringAtoB = atob(encodedStringBtoA);
const deCalculateTime = decodedStringAtoB/5
A C G E A A G A A
E G A C G E Bb Bb A G F
E G A Bb A G F E G G A
E G Bb A G F
D A G F D E D
E A G F E D A G
F E D C G F
E D C D F E D E F G Bb A
E A G F E D A G
F E D C G F
E D C D F F E F G F ? ? ?
3 6 7 1' 6
3 6 7 1' 7 6 1' 7 6 3' 3' 3'
2#' 3' 4' 4'
4' 3' 2'# 4' 3
2'# 1' 7 3' 1' 7 6
4 5 6 6 2 6 6 5
4 3 4 5 1 5 5 4
2 3 4 4 3 2 3 4 4 3 2 3 1
4 5 6 6 2 6 6 5
3 4 5 5 4# 5 6 6# 6 5
6 6# 6 6# 5 2 6 6# 6 5 4
1 4 444 4445421
4 1 4 4 1 1
4 3 4 6 5 4 5
5 1 5 5 1 1
5 6 5 2 3 4
2 3 4 2 3 4 6 5 4 5
3 4 5 3 4 5 6# 6 5
2 3 4 1 1 1
2 3 4 1 2 3
5 5 4 4 3 2 3 4 5 5