Skip to content

Instantly share code, notes, and snippets.

View phannaly's full-sized avatar
🎴
Trekking

phanna phannaly

🎴
Trekking
View GitHub Profile

We can fetch public certificate from server with IP or domain. ex: 10.10.1.20

openssl s_client -connect 10.10.1.20:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > certificate.crt

Make sure that certificate.crt only contain between the BEGIN CERTIFICATE and END CERTIFICATE lines

-----BEGIN CERTIFICATE-----
..........................
-----END CERTIFICATE-----
@phannaly
phannaly / AuthorizedClients.vue
Created January 14, 2019 17:14
Laravel 5.4 OAuth2 token and client components ported to Vue.js 2 and Bulma with Axios
<style scoped>
.action-link {
cursor: pointer;
}
.m-b-none {
margin-bottom: 0;
}
</style>
@phannaly
phannaly / .htaccess
Created February 7, 2018 01:37 — forked from vielhuber/.htaccess
Apache: htaccess force www and https ssl #server
# force HTTPS and www.
RewriteEngine On
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L]
# alternative way
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
@phannaly
phannaly / .gitlab-ci.yml
Created December 20, 2017 07:06 — forked from spoonerWeb/.gitlab-ci.yml
GitLab CI (version >= 9) configuration for testing and TER uploading TYPO3 extensions
cache:
key: "$CI_COMMIT_REF_NAME/$CI_JOB_STAGE"
paths:
- .composer/
before_script:
# Install git on machine
- apk add git --update
stages:

How to create virtualhost in Apache2

Go to apache directory

sudo vim /etc/apache2/sites-available/example.com.conf

example.com can refer to your domain name. You should put the name that make sense for you.

Copy script below to your example.com.conf

@phannaly
phannaly / fedora_install_lamp_stack.md
Created September 8, 2017 09:51
Install lamp stack on Fedora

Install LAMP Stack on Fedora

Clear dnf database and cache

sudo dnf clean all

Install Apache

@phannaly
phannaly / example.js
Created September 6, 2017 08:06 — forked from millermedeiros/example.js
execute multiple shell commands in series on node.js
// USAGE ------
// ============
var shell = require('./shellHelper');
// execute a single shell command
shell.exec('npm test --coverage', function(err){
console.log('executed test');
}});
@phannaly
phannaly / mongodb_ubuntu.md
Last active August 14, 2017 16:17
Install Mongodb on ubuntu

Install Mongodb in Ubuntu 16.04

Since we are adding the new resource, The Ubuntu verify the authenticity by checking whether they signed using GPS Keys.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

Add Mongodb repository

Secure Nginx

Update and upgrade ubuntu package

sudo apt-get update && sudo apt-get upgrade

Upgrade Nginx to get new feature

@phannaly
phannaly / 0_reuse_code.js
Created August 14, 2017 04:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console