Skip to content

Instantly share code, notes, and snippets.

View lirantal's full-sized avatar
💟
Writing a book on Node.js Secure Coding

Liran Tal lirantal

💟
Writing a book on Node.js Secure Coding
View GitHub Profile
@lirantal
lirantal / example-regex.js
Created February 9, 2018 15:27
How a RegEx can bring your system down
var testEmail = /^([a-zA-Z0-9])(([\-.]|[_]+)?([a-zA-Z0-9]+))*(@){1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a-z]{2,3}[.]{1}[a-z]{2,3}))$/.exec('john@example.com');
@lirantal
lirantal / jscodemod-import-statistics.js
Created July 7, 2017 05:54
jscodemod-import-statistics
const fs = require('fs');
const crypto = require('crypto');
module.exports = function transformer(file, api, options) {
const j = api.jscodeshift;
const importSource = options.importSource || '';
const importInstances = [];
j(file.source)
.find(j.ImportDeclaration)
@lirantal
lirantal / protractor_element_explorer.md
Last active October 3, 2018 19:59
protractor element explorer
@lirantal
lirantal / terminal-with-powerline.sh
Last active December 2, 2022 09:19
Hyper terminal + Powerline 9k terminal theme for oh-my-zsh
# Use hyper.is or iTerm2 as terminal emulators
# Install ohmyzsh
# https://github.com/robbyrussell/oh-my-zsh
# Copy over configs from ~/.bash_profile
# For example, it may have the nvm setup or any aliases like exa=ls and cat=bat
# ~/.hyper.js configuration:
copyOnSelect: true
@lirantal
lirantal / index.js
Last active March 26, 2017 03:09
LicenseWatch-CLI With Blessed UI
'use strict'
const LicenseWatch = require('licensewatch')
const blessed = require('blessed')
const blessedContrib = require('blessed-contrib')
const fs = require('fs')
const screen = blessed.screen()
var bar = blessedContrib.bar({
@lirantal
lirantal / MEAN.JS 2 API Server
Created December 24, 2016 10:54
MEAN.JS 2 API Server
# Packages
## Removed
* `node-inspector` not compatible with Node v7 and not required due to new V8 `debug` parameter support
* `phantomjs-prebuilt` not required for backend
## Added
* `sequelize` library for SQL-based ORM
* `mysql` library as the default SQL engine for the sequelize ORM
@lirantal
lirantal / gist:a0b5189049ffc2349ed3816c0cdf4607
Created November 27, 2016 10:10
Nginx Proxy Pass for API/Frontend servers
nginx config: `/etc/nginx/sites-enabled/default`
```
server {
location / {
proxy_pass http://localhost:3000;
}
location /api {
# Android SDK setup
## Install Java
```bash
sudo apt-get update
sudo dpkg --add-architecture i386
sudo apt-get install libbz2-1.0:i386
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1
sudo apt-get install openjdk-8-jdk openjdk-8-jre
# mitmproxy tool
# http://docs.mitmproxy.org/en/stable/
# installation
sudo apt-get install python-pyasn1 python-flask python-urwid python-dev libxml2-dev libxslt-dev libffi-dev python-pip libssl-dev libjpeg8-dev zlib1g-dev
pip install mitmproxy
# run
~/.local/bin/mitmproxy --host
@lirantal
lirantal / cloud9-php7
Last active November 12, 2018 12:15
Cloud9 PHP7 support
# Installing/Upgrading to PHP 7 from a current PHP 5.5
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update -y
sudo apt-get install php7.0-curl php7.0-cli php7.0-dev php7.0-gd php7.0-intl php7.0-mcrypt php7.0-json php7.0-mysql php7.0-opcache php7.0-bcmath php7.0-mbstring php7.0-soap php7.0-xml php7.0-zip -y
sudo mv /etc/apache2/envvars /etc/apache2/envvars.bak
sudo apt-get remove libapache2-mod-php5 -y
sudo apt-get install libapache2-mod-php7.0 -y