Skip to content

Instantly share code, notes, and snippets.

View thlinhit's full-sized avatar
😵
I may be slow to respond.

Truong H. Linh thlinhit

😵
I may be slow to respond.
View GitHub Profile
@thlinhit
thlinhit / Ansible Let's Encrypt Nginx setup
Created December 5, 2020 16:16 — forked from mattiaslundberg/Ansible Let's Encrypt Nginx setup
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@thlinhit
thlinhit / protractor.screenshot.reporter.js
Created July 3, 2019 10:52 — forked from jlouros/protractor.screenshot.reporter.js
Protractor configuration to take screenshots on test failures (using Jasmine framework)
/* eslint import/no-extraneous-dependencies: ["off"] */
/* eslint func-names: ["off"] */
/* global browser */
/**
* Jasmine reporter used to take screenshots every time a test fails
* on your 'protractor.conf.js' (Protractor configuration file)
* include a reference to this file `const ScreenshotReporter = require('./screenshotReporter.js');`
* and hook it up inside 'onPrepare()' `jasmine.getEnv().addReporter(new ScreenshotReporter('reports/e2e-failures'));`
*/
@thlinhit
thlinhit / jest-setup.ts
Created July 2, 2019 05:05
Jest test + debug
import 'jest-preset-angular';
window.matchMedia =
window.matchMedia ||
(() => {
return ({
matches: false,
addListener: () => {},
removeListener: () => {}
} as unknown) as MediaQueryList;
@thlinhit
thlinhit / EntityQuery.java
Created June 15, 2019 08:35 — forked from ufuk/JpaEntityQueryBuilder.java
Easy to use query builder for JPA Criteria API (including example usages)
package ...;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.*;
import java.util.*;
import java.util.stream.Collectors;