This was tested on:
- Ubuntu 14.04 x64
- Ubuntu 16.04 x64
| //PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012 | |
| //UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler" | |
| //the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist | |
| (function(host) { | |
| function Crawler() { | |
| this.visitedURLs = {}; | |
| }; | |
| /** | |
| * loadJSONP( url, hollaback [, context] ) -> Null | |
| * - url (String): URL to data resource. | |
| * - hollaback (Function): Function to call when data is successfully loaded, | |
| * it receives one argument: the data. | |
| * - context (Object): Context to invoke the hollaback function in. | |
| * | |
| * Load external data through a JSONP interface. | |
| * | |
| * ### Examples |
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
tar -xvf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
cd wkhtmltox/bin/
sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
sudo mv wkhtmltoimage /usr/bin/wkhtmltoimage
You can check here for getting the latest version. Change the wget url to download newer versions.
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
$ sudo mv wkhtmltoimage /usr/bin/wkhtmltoimage
$ sudo chmod a+x /usr/bin/wkhtmltopdf
| // modules | |
| var redis = require('redis'); | |
| var Step = require('step'); | |
| // config file | |
| var config = require('config'); | |
| // mysql client connect | |
| var mysql = require('mysql'); | |
| var connection = mysql.createConnection({ |
| #! /usr/bin/env python | |
| import redis | |
| import random | |
| import pylibmc | |
| import sys | |
| r = redis.Redis(host = 'localhost', port = 6389) | |
| mc = pylibmc.Client(['localhost:11222']) |
| from selenium import webdriver | |
| from selenium.webdriver.remote.webelement import WebElement | |
| import os.path | |
| # JavaScript: HTML5 File drop | |
| # source : https://gist.github.com/florentbr/0eff8b785e85e93ecc3ce500169bd676 | |
| # param1 WebElement : Drop area element | |
| # param2 Double : Optional - Drop offset x relative to the top/left corner of the drop area. Center if 0. | |
| # param3 Double : Optional - Drop offset y relative to the top/left corner of the drop area. Center if 0. | |
| # return WebElement : File input |
| from selenium import webdriver | |
| from selenium.webdriver.remote.webelement import WebElement | |
| import os.path | |
| # JavaScript: HTML5 File drop | |
| # source : https://gist.github.com/florentbr/0eff8b785e85e93ecc3ce500169bd676 | |
| # param1 WebElement : Drop area element | |
| # param2 Double : Optional - Drop offset x relative to the top/left corner of the drop area. Center if 0. | |
| # param3 Double : Optional - Drop offset y relative to the top/left corner of the drop area. Center if 0. | |
| # return WebElement : File input |
Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.
git revert {commit_id}'
Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32: