Skip to content

Instantly share code, notes, and snippets.

David Pennington Xeoncross

Block or report user

Report or block Xeoncross

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Xeoncross
Xeoncross / facebook_canvas_app.md
Last active Aug 29, 2015
Things I'm learning about writing a facebook canvas application
View facebook_canvas_app.md
  • You must setup an SSL cert to make your life easy.

  • Create a fake app.localhost.loc virtual host or something by editing your /etc/hosts or windows hosts file and pointing that domain to 127.0.0.1 and then editing your nginx or Apache config.

  • For FB login You can't do a header() redirect because of X-Frame-Options. Use Javascript instead:

      <html><script>top.location.href = "loginUrl";</script></html>
    
  • All requests that should be HTTP GET will become POST requests.

View facebook-login.sh
#!/bin/bash
# If it redirects to http://www.facebook.com/login.php at the end, wait a few minutes and try again
EMAIL='YOUR_EMAIL' # edit this
PASS='YOUR_PASSWORD' # edit this
COOKIES='cookies.txt'
USER_AGENT='Firefox/3.5'
View facebook.php
<?php
class FacebookBase {
public static $curlOpts = array(
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_USERAGENT => 'facebook-php',
);
@Xeoncross
Xeoncross / scrape.js
Created Mar 19, 2014
large scalle node.js website scrapping
View scrape.js
2.9M Websites Downloaded -> 16.3 Minutes
Patrick McConlogue
Votes by Christian Hochfilzer, Nervan Andrew, Tek Neeque, and Grahesh Parkar.
Per my last post I discussed how to scrape at scale. While there is a tricky memory leak in this, here is the script (for "ring".com) to download and get the pagerank for almost three million websites based on a maximum of 500000 queries.
http://thnkr.quora.com/2-9M-Websites-Downloaded-16-3-Minutes
NOTES:
Essentially, whatever you put into the "list.txt" file will be scrape and the top 10 results will be downloaded in JSON.
View httpclient.go
package httpclient
import (
"net"
"net/http"
"time"
)
type Config struct {
ConnectTimeout time.Duration
View MimeMailParser.class.php
<?php
require_once('attachment.class.php');
/**
* Fast Mime Mail parser Class using PHP's MailParse Extension
* @author gabe@fijiwebdesign.com
* @url http://www.fijiwebdesign.com/
* @license http://creativecommons.org/licenses/by-sa/3.0/us/
* @version $Id$
View fb-parse-feed-curl.php
</php
/**
* Facebook Page Feed Parser
*
* @using cURL
*/
function fb_parse_feed( $page_id, $no = 5 ) {
// URL to the Facebook page's RSS feed.
View ocp.php
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.6
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
0.1.5 2013-04-12 added graphs to visualize cache state, please report any browser/style bugs
View sslclient.php
class SSLSocket {
public $s = null;
public $on_err = null;
public $on_read = null;
public $on_readComplete = null;
public $on_timeout = null;
public $on_write = null;
public $endpoint = null;
public $wbuffer = array();
public $timer = null;
View composer.json
{
"require": {
"php": ">=5.5.0",
"christiaan/stream-process": "1.0.*",
"mkraemer/react-inotify": "dev-master",
"mkraemer/react-pcntl": "dev-master"
}
}
You can’t perform that action at this time.