Skip to content

Instantly share code, notes, and snippets.

View ethanliew's full-sized avatar

Ethanz Liew ethanliew

View GitHub Profile
@ethanliew
ethanliew / aes_encryption_helper.dart
Created December 26, 2018 05:50 — forked from proteye/aes_encryption_helper.dart
How to AES-256 (CBC/CFB mode) encrypt and decrypt in Dart/Flutter with Pointy Castle
import 'dart:convert';
import 'dart:typed_data';
import "package:pointycastle/export.dart";
import "./convert_helper.dart";
// AES key size
const KEY_SIZE = 32; // 32 byte key for AES-256
const ITERATION_COUNT = 1000;
@ethanliew
ethanliew / ultimate-ut-cheat-sheet.md
Created October 6, 2018 09:02 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@ethanliew
ethanliew / Git push deployment in 7 easy steps.md
Created September 16, 2018 01:00 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@ethanliew
ethanliew / git-deployment.md
Created September 16, 2018 00:51 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your lokal GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like my Deepl.io to act upon a Web-Hook that's triggered that service.

FFmpeg has been removed from Ubuntu 14.04 and was replaced by Libav. This decision has been reversed so that FFmpeg is available now in Ubuntu 15.04 again, but there is still no official package for 14.04. In this tutorial, I will show you how to install FFmpeg from mc3man ppa. Add the mc3man ppa:
sudo add-apt-repository ppa:mc3man/trusty-media
And confirm the following message by pressing <enter>:
Also note that with apt-get a sudo apt-get dist-upgrade is needed for initial setup & with some package upgrades
More info: https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media
Press [ENTER] to continue or ctrl-c to cancel adding it
Update the package list.
@ethanliew
ethanliew / curl.md
Created September 7, 2018 03:19 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ethanliew
ethanliew / aspnet-core-2-ubuntu-setup.md
Created July 22, 2018 09:47 — forked from odan/aspnet-core-2-ubuntu-setup.md
Installing ASP.NET Core 2.1 on Ubuntu 18.4 Linux
@ethanliew
ethanliew / .htaccess - Prevent Script Injection
Created February 5, 2018 03:45 — forked from unix7/.htaccess - Prevent Script Injection
.htaccess - Prevent Script Injection
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
//Source: http://wp.smashingmagazine.com/2010/07/01/10-useful-wordpress-security-tweaks/
@ethanliew
ethanliew / ca.md
Created October 19, 2017 08:46 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@ethanliew
ethanliew / gist:ad0ee3ea7274298e70055f0bab36079d
Created October 14, 2017 06:52 — forked from rolinger/gist:d6500d65128db95f004041c2b636753a
PHP => FCM Push notification tutorial for Android and iOS
Below is a full tutorial on how to setup and use Googles Firebase push notification API for both Android and iOS. It is based on this
earlier implementation of Googles GCM method: https://gist.github.com/prime31/5675017 - FCM is the new method and GCM will eventually be
retired.
## THE BELOW METHOD IS THE NEWER FCM METHOD:
Register your app in the FCM Console: https://console.firebase.google.com (add project)
1. Click on the newly added project, in the upper left menu is the "Overview" and Gear Settings.
2. Click on the GEAR settings icon, and then on "Project Settings"
3. In the main screen, click on "Cloud Messaging"