#CURL Connections with Tor
Install Apache, PHP, CURL & Tor with apt-get
sudo apt-get install -y apache2 php5 php5-curl torTor creates a proxy on your mashine with port 9050 for SOCKS5 connections.
| #!/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 |
| <?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 | |
| * |
| * 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)); |
| // ==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/* |
| 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 ); |
#CURL Connections with Tor
Install Apache, PHP, CURL & Tor with apt-get
sudo apt-get install -y apache2 php5 php5-curl torTor creates a proxy on your mashine with port 9050 for SOCKS5 connections.
| # Install R | |
| sudo apt update | |
| sudo apt install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev | |
| # Install RStudio | |
| cd ~/Downloads | |
| wget https://download1.rstudio.org/rstudio-xenial-1.1.447-amd64.deb | |
| sudo gdebi rstudio-xenial-1.1.447-amd64.deb | |
| printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile |
| 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" |
| // ==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 |