Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
PHANTOM_JS="phantomjs-1.9.8-linux-x86_64"
if [[ $EUID -ne 0 ]]; then
echo "You must be a root user" 2>&1
exit 1
else
apt-get update
apt-get install -y build-essential chrpath libssl-dev libxft-dev
apt-get install -y libfreetype6 libfreetype6-dev
apt-get install -y libfontconfig1 libfontconfig1-dev
@thocell
thocell / is-cloudflare-ip.php
Created February 21, 2016 12:11 — forked from josuecau/is-cloudflare-ip.php
Check if a given IPV4 belongs to Cloudflare. Usage : `php is-cloudflare-ip.php 108.162.242.71`
<?php
/**
* Check if a given ip is in a network.
*
* @link https://gist.github.com/tott/7684443
*
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
*
@thocell
thocell / 5 cheap (less than $5) and reliable vps comparison and how to earn $25 for free.md
Last active April 15, 2024 04:25
A comparison between 5 cheap VPS providers with plans below $5 per month and how to earn $25 for free.

Here is a basic comparison between 5 reliable and cheap VPS providers with plans below $5 per month.

VPS Companies


OVH Linode DigitalOcean Scaleway Vultr
Foundation 1999 2003 2011 2013 2014
Headquarters Roubaix (FR) Galloway, NJ (US) New York (US) Paris (FR) Matawan, NJ (US)
@thocell
thocell / Install_python3.6.4
Last active May 11, 2018 13:36
Install python 3.6.4 on ubuntu 14.04
****
* For the Ubuntu 14.04 system, it is not easay to install python 3.6 and make pip3 work using the python3.6.4 path. If installed from the repository with ppa:jonathonf/python-3.6,
* there are always problems to use pip3 to call python 3.6.4. So this gist will help to solve such problems.
******
sudo apt-get install build-essential checkinstallsudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
cd ~
sudo wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
sudo tar xzf Python-3.6.4.tgz
@thocell
thocell / youtube-dl-python-3.6
Last active April 10, 2020 16:19
Force youtube-dl to use python 3.6
Since python 2.x will be deprecated in 2020, it is better to use python 3.x for youtube-dl.
Plus, python 3.6 runs faster. But for ubuntu, normaly, youtube-dl just uses python 2.x.
Here is how to force youtube-dl to use python 3.6.
*1.Install python3.6 according to this gist:
https://gist.github.com/thodison/3dfcff7d09560357c9c6a9b453e0d6ed
*2.Edit ~/.bashrc
Add the folloing line on the top, then save and close it:
alias python3="python3.6"
@thocell
thocell / get_headers_alternative.php
Last active May 13, 2018 11:52
Get headers using curl--php
* In php, the function "get_headers" sometimes is slow, especially if you want to get headers of a batch of urls in parallel.
* In this case, you should use curl.
function get_headers_curl($url){
$curl = curl_init();
curl_setopt_array( $curl, array(
CURLOPT_HEADER => true,
CURLOPT_NOBODY => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url));
@thocell
thocell / ditillvideo.user.js
Last active June 11, 2018 10:22
Browser extension to download youtube videos
// ==UserScript==
// @name DistillVideo Downloader
// @namespace https://distillvideo.com/
// @version 1.0
// @description Browser extension to download videos
// @author DistillVideo
// @copyright 2018, DistillVideo
// @homepage https://distillvideo.com/page/extensions
// @downloadURL https://distillvideo.com/js/ditillvideo.user.js
// @match *://*.youtube.com/*
@thocell
thocell / Video_Audio_Downloader.js
Last active February 4, 2024 05:35
The Tampermonkey userscript to download video and audio from Youtube, Twitter, Vimeo, Facebook, Dailymotion, 1tv, VK, youku, bilibili and 5000 more sites for free. Fast and easy to use.
// ==UserScript==
// @name Distill Video & Audio Downloader from 5000+ sites including Youtube, Support 1080P, 2K, 4k & 8K
// @namespace https://distillvideo.com/
// @version 2.1.1
// @date 2018-06-17
// @description Browser extension to download video and audio from Youtube, Twitter, Vimeo, Facebook, Dailymotion, 1tv, VK, youku, bilibili and 5000 more sites for free. Fast and easy to use.
// @author DistillVideo.com
// @copyright 2018, DistillVideo.com
// @homepage https://distillvideo.com/page/extensions
// @downloadURL https://distillvideo.com/js/ditillvideo.user.js
@thocell
thocell / Subtitle Downloader for youtube, ted, vimeo, dramafever and more. Auto subtitle supported.
Created June 24, 2018 19:53
Download subtitles or captions from Youtube, TED, Vimeo, Dramafever, Dailymotion, etc. Support mutiple languages. For Youtube, both closed captions (CC) and automatic captions (auto-generated subtitles) can be downloaded if they are available. Fast and easy to use.
// ==UserScript==
// @name Best Subtitle Downloader for youtube, ted, vimeo, dramafever and more. Auto subtitle supported.
// @namespace https://distillvideo.com/
// @version 2.1
// @date 2018-06-23
// @description Download subtitles or captions from Youtube, TED, Vimeo, Dramafever, Dailymotion, etc. Support mutiple languages. For Youtube, both closed captions (CC) and automatic captions (auto-generated subtitles) can be downloaded if they are available. Fast and easy to use.
// @author DistillVideo.com
// @copyright 2018, DistillVideo.com
// @homepage https://distillvideo.com/page/extensions
// @compatible chrome
@thocell
thocell / getheaders.php
Created June 29, 2018 14:09
get header info by php
function getFileInfo($url){
$ch = curl_init($url);
curl_setopt( $ch, CURLOPT_NOBODY, true );
curl_setopt( $ch, CURLOPT_HEADER, false );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, false );
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt( $ch, CURLOPT_MAXREDIRS, 3 );
curl_exec( $ch );
$headerInfo = curl_getinfo( $ch );
curl_close( $ch );