Skip to content

Instantly share code, notes, and snippets.

Ken Ng kenng

Block or report user

Report or block kenng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kenng /
Created May 13, 2019 — forked from rambabusaravanan/
AWS Lambda Function to send SMTP Email
import smtplib
import os
def send_email(host, port, username, password, subject, body, mail_to, mail_from = None, reply_to = None):
if mail_from is None: mail_from = username
if reply_to is None: reply_to = mail_to
message = """From: %s\nTo: %s\nReply-To: %s\nSubject: %s\n\n%s""" % (mail_from, mail_to, reply_to, subject, body)
print (message)
kenng / listAllEventListeners.js
Created Apr 7, 2019 — forked from dmnsgn/listAllEventListeners.js
List all event listeners in a document
View listAllEventListeners.js
const listeners = (function listAllEventListeners() {
let elements = [];
const allElements = document.querySelectorAll('*');
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];
kenng / php
Created Feb 13, 2019
View php
* PHPMailer - PHP email creation and transport class.
* PHP Version 5.5.
* @see The PHPMailer GitHub project
* @author Marcus Bointon (Synchro/coolbru) <>
* @author Jim Jagielski (jimjag) <>
* @author Andy Prevost (codeworxtech) <>
kenng / php
Last active Feb 27, 2019
php mail function
View php
class IwMail {
protected $subject;
protected $headers;
protected $content;
protected $to;
protected $from;
public $mail;
kenng / php
Last active Jan 30, 2019
php debug
View php
public static function WriteErrorFile(String $msg) {
$fpath = base_path() . '/errors.log';
$fpath = "/Applications/AMPPS/www/";
error_log(print_r($msg, TRUE), 3, $fpath);
public static function backtrace($skip=0, $limit=12) {
$dump = [];
$mydump = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, $limit);
kenng / javascript
Created Jan 22, 2019
particle json
View javascript
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
"color": {
kenng / important.css
Created Jan 22, 2019 — forked from tzi/important.css
How to set an !important css property in javascript
View important.css
.test {
height: 139px;
width: 96px
View javascript
function loadScript(url) {
var script = document.createElement("script"); // create a script DOM node
script.src = url; // set its src to the provided URL
pass in either myDOM, myid, or myclass, just one of them
kenng /
Created May 15, 2018 — forked from dannguyen/
Use wget to snapshot a page and its necessary visual dependencies

Use wget to mirror a single page and its visible dependencies (images, styles)

Money graphic via State of Florida CFO Vendor Payment Search

Graphic via State of Florida CFO Vendor Payment Search (

This is a quick command I use to snapshot webpages that have a fun image I want to keep for my own collection of WTFViz. Why not just right-click and save the image? Oftentimes, the webpage in which the image is embedded contains necessary context, such as captions and links to important documentation just incase you forget what exactly that fun graphic was trying to explain.

You can’t perform that action at this time.