Skip to content

Instantly share code, notes, and snippets.

View plonknimbuzz's full-sized avatar

plonknimbuzz plonknimbuzz

  • MoF
  • Jakarta, Indonesia
View GitHub Profile
@plonknimbuzz
plonknimbuzz / imagemagick7.sh
Last active November 28, 2018 08:46 — forked from marcinwol/imagemagick7.sh
Install ghostscript, ffmpeg, ImageMagick 7 on Ubuntu 16.04
sudo apt install ffmpeg ghostscript libgs-dev build-essential autoconf automake autopoint chrpath cm-super-minimal debhelper dh-autoreconf dh-strip-nondeterminism doxygen doxygen-latex gir1.2-rsvg-2.0 graphviz libbz2-dev libcairo-script-interpreter2 libcairo2-dev libcdt5 libcgraph6 libclang1-3.6 libdjvulibre-dev libexif-dev libfftw3-bin libfftw3-dev libfftw3-long3 libfftw3-quad3 libfile-stripnondeterminism-perl libfontconfig1-dev libfreetype6-dev libgdk-pixbuf2.0-dev libglib2.0-dev libgvc6 libgvpr2 libharfbuzz-dev libharfbuzz-gobject0 libice-dev libilmbase-dev libjasper-dev libjbig-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libjs-jquery liblcms2-dev libllvm3.6v5 liblqr-1-0-dev liblzma-dev libobjc-5-dev libobjc4 libopenexr-dev libpango1.0-dev libpathplan4 libpcre3-dev libpcre32-3 libpcrecpp0v5 libperl-dev libpixman-1-dev libpng12-dev libpotrace0 libptexenc1 libpthread-stubs0-dev librsvg2-bin librsvg2-dev libsigsegv2 libsm-dev libsynctex1 libtexlua52 libtexluajit2 libtiff5-dev libtif
<?php
private function parseRawData2($str)
{
if (preg_match_all(
"/<div class=\"result-link\">.+<h3>.+<a href=\"([^\s]*)\".+title=\"(.*)\" class.+>.+<div class=\"excerpt\">(.+)<\/div>/Usi",
$str,
$m
)) {
@plonknimbuzz
plonknimbuzz / adduser-to-www-data.sh
Last active August 8, 2018 00:24
add user to www-data
sudo adduser existingUser www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www
#ubuntu
#install phantomjs 2.1.1
#32bit
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-i686.tar.bz2
#64bit
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
mkdir -p /usr/local/share/phantomjs
tar -xjvf phantomjs-2.1.1-linux-*.tar.bz2 --strip-components=1 -C /usr/local/share/phantomjs/
ln -sf /usr/local/share/phantomjs/bin/phantomjs /usr/local/bin
@plonknimbuzz
plonknimbuzz / howto.md
Created November 28, 2018 08:40 — forked from leomelzer/howto.md
Installing ImageMagick & Ghostscript on Ubuntu
  1. You have Ghostscript installed, right? Otherwise sudo apt-get install ghostscript
  2. This is important and installs the headers (iapi.h etc) which are required but don't come with the default Ghostscript package: sudo apt-get install libgs-dev
  3. I also needed sudo apt-get install gs-esp
  4. For me the pre compiled version of ImageMagick never accepted Ghostscript, so let's remove it: sudo apt-get --purge remove imagemagick
  5. Get the source of ImageMagick, untar it, cd ImageMagick-xx
  6. ./configure --with-gslib=yes [and what else you need]
  7. Confirm in the output near the bottom gslib yes yes and not gslib yes no
  8. make
  9. make install
  10. Run convert -list configure | grep DELEGATES => DELEGATES bzlib djvu freetype gs jpeg jng jp2 lcms png tiff x11 xml zlib
@plonknimbuzz
plonknimbuzz / sources.list
Created December 3, 2018 09:42
Ubuntu 18.04 Bionic default /etc/apt/sources.list
#deb cdrom:[Ubuntu 18.04 LTS _Bionic Beaver_ - Release amd64 (20180426)]/ bionic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
@plonknimbuzz
plonknimbuzz / gist:c9ded3d2446c4b330a6252ee17a8e8ea
Created March 29, 2019 00:33 — forked from artturik/gist:a15d890dcfedfe8af813
Convert PhantomJs cookies to NetScape HTTP cookie file format
// Convert PhantomJs cookies to NetScape HTTP cookie file format
// NOTE: It dose not create NetScape HTTP cookie file, this function return only cookie file contents
// NOTE: PhantomJs do not store "host only" cookie param, all cookies will have "host only" param set to false (line 15)
// I use this function to export PhantomJs cookies to CURL cookiejar file
// This is modified version of EditThisCookie cookie_helpers.js cookiesToString function
// USAGE: phantomJsCookiesToNetScapeString(phantom.cookies);
var phantomJsCookiesToNetScapeString = function(cookies) {
var string = "";
string += "# Netscape HTTP Cookie File\n";
@plonknimbuzz
plonknimbuzz / addview.php
Last active April 20, 2019 19:05
example traffic lesson
<?php
$url = 'http://localhost/index.php'; //change me
$user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20100101 Firefox/7.0.1';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl,CURLOPT_USERAGENT,$user_agent);
$result=curl_exec($ch);
curl_close($ch);
@plonknimbuzz
plonknimbuzz / script.js
Last active July 29, 2021 18:12
Download google maps image using web console
/*
just for urgent needed, dont spam this.
Just copy this script into web console and run the function.
If you want to download the image, just edit downloadFile=true
Note:
- workflow: get all image src or div background-image, then filter it as our needs
- you can edit this file to scrape another website if you want. just change my regex or remove it
Usage:
@plonknimbuzz
plonknimbuzz / request.php
Created May 10, 2022 09:39
PHP Curl Forwarder
<?php
$data = json_decode(file_get_contents('php://input'));
$url = null;
if($data){
$request_type = 'JSON';
$url = isset($data->target_url)?$data->target_url:null;
}elseif(isset($_POST)){
$request_type = 'POST';
$data = isset($_POST)?$_POST:null;