Skip to content

Instantly share code, notes, and snippets.

View jimmy18dev's full-sized avatar
🎯
Focusing

Puwadon Sricharoen jimmy18dev

🎯
Focusing
View GitHub Profile
@jimmy18dev
jimmy18dev / Kong-Installation.sh
Created March 19, 2018 07:39
Kong Installation (Docker)
#!/bin/bash
network="kong_network"
clear
echo "[Clear all container and network]"
docker container stop kong-database kong
docker container rm kong-database kong
docker network rm $network
echo "[Craete network with $network]"
@jimmy18dev
jimmy18dev / Kong API
Created March 8, 2018 06:59
Kong API
docker run -d --name kong-database --network=dockerphp7_default -p 5432:5432 -e "POSTGRES_USER=kong" -e "POSTGRES_DB=kong" postgres:9.4
docker run --rm --link kong-database:kong-database --network=dockerphp7_default -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" kong:latest kong migrations up
docker run -d --name kong --link kong-database:kong-database --network=dockerphp7_default -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=kong-database" -e "KONG_CASSANDRA_CONTACT_POINTS=kong-database" -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" -e "KONG_PROXY_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_LISTEN=0.0.0.0:8001" -e "KONG_ADMIN_LISTEN_SSL=0.0.0.0:8444" -p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 kong:latest
curl -i -X GET --url http://localhost:8000/ --header 'Host: localhost'
@jimmy18dev
jimmy18dev / openssl-encrypt-decrypt.php
Last active March 2, 2018 04:04
php openssl encrypt and decrypt
private function Encrypt($data){
$key = $this->key;
$password = $this->cookie_salt;
$encryption_key = base64_decode($key.$password);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted = openssl_encrypt($data, 'aes-256-cbc', $encryption_key, 0, $iv);
return base64_encode($encrypted . '::' . $iv);
}
private function Decrypt($data){
I have an existing project
cd /path/to/your/repo
git remote add origin https://xxx@bitbucket.org/repo.git
git push -u origin master
I'm starting from scratch
git clone https://xxx@bitbucket.org/repo.git
cd /path/to/your/repo
echo "# My project's README" >> README.md
git add README.md