Skip to content

Instantly share code, notes, and snippets.

View fernyb's full-sized avatar

Fernando Barajas fernyb

View GitHub Profile
#!/bin/bash
wget http://chromedriver.storage.googleapis.com/2.16/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo chmod +x chromedriver
sudo chown root:root chromedriver
sudo mv chromedriver /usr/local/bin
wget http://chrome.richardlloyd.org.uk/install_chrome.sh
chmod u+x install_chrome.sh
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
The php.ini file can be found in:
/usr/local/etc/php/5.6/php.ini
✩✩✩✩ PEAR ✩✩✩✩
If PEAR complains about permissions, 'fix' the default PEAR permissions and config:
chmod -R ug+w /usr/local/Cellar/php56/5.6.12/lib/php
@fernyb
fernyb / Redis
Last active August 29, 2015 14:24
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
@fernyb
fernyb / gist:18a6654c1a526138367f
Created November 28, 2014 00:31
mitmproxy (mitmdump) script to print response body
import sys
import cStringIO
from PIL import Image
from libmproxy.protocol.http import decoded
def response(context, flow):
content_type = flow.response.headers.get_first("content-type", "")
sys.stdout.write("Content Type: "+ content_type +"\n\n")
if content_type.startswith("text"):
sys.stdout.write("Response Content: "+ flow.response.content +"\n\n")
@fernyb
fernyb / gist:2e8348ab916dd240a39c
Last active August 29, 2015 14:10
Mac OSX Settting Proxy via Command Line
Show the active interface:
ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'
List All Network Services with information which interface they use:
sudo networksetup -listnetworkserviceorder
To set the Proxy:
sudo networksetup -setwebproxystate "Wi-Fi" off
sudo networksetup -setwebproxy "Wi-Fi" 127.0.0.1 8080
Capture HTTP Headers
sudo tcpdump -l -s0 -w - tcp dst port 80 | strings
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# http://git-scm.com/book/en/Git-Basics-Undoing-Things
# Undo a merge
git revert -m 1 commit_hash
@fernyb
fernyb / gist:4caec5950d95998ab5a4
Last active August 29, 2015 14:01
Remote Debugging Protocol
# View the messages sent to the websocket
# https://developers.google.com/chrome-developer-tools/docs/debugger-protocol
#
_old_send = function(msg) { console.log(msg); console.log(" "); WebInspector.socket.send(msg); };
InspectorFrontendHost.sendMessageToBackend = _old_send;
WebInspector.socket.onmessage = function(message) { console.log(message.data); console.log(" "); InspectorBackend.dispatch(message.data); };
Sent:
@fernyb
fernyb / gist:6fbbb50decb2ea1bf441
Created May 7, 2014 13:47
Close current tab iPad Simulator
tell application "System Events" to tell process "iPhone Simulator"
tell application "iPhone Simulator" to activate
delay 1
tell window "iOS Simulator - iPad Retina / iOS 7.1 (11D167)"
--get the name of window 1
--get every window
click button 8
--get every button