Skip to content

Instantly share code, notes, and snippets.

View zbone3's full-sized avatar

Ziv zbone3

  • Tel Aviv
View GitHub Profile
@zbone3
zbone3 / facebook-login.rb
Created February 7, 2018 09:22
Simple ruby class that allows to login to Facebook via HTTP client. This is for educational purposes only, you should always use the official API.
require 'rest_client'
require 'nokogiri'
class FacebookLogin
def initialize(username, password)
@cookies = {}
@payload = {email: username, pass: password}
@headers = {'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36'}
# Define login flow
@login_steps = [
@zbone3
zbone3 / read_write_with_mode_detection.js
Last active February 7, 2018 09:08
In order to keep text files readable and other files (images, fonts etc.) in tact you will need to know the fs read/write mode. Use case: iterate a directory recursively, edit specific text files only, then copy all file types to a new location.
let fs = require('fs');
let path = require('path');
let inputDir = '/in';
let outputDir = '/out';
function modifyFile(buffer, mode) {
let content = buffer;
if (mode == 'utf-8') {
// Code to modify text files