Skip to content

Instantly share code, notes, and snippets.

@mario21ic
mario21ic / socat_examples
Created June 23, 2017 17:42
Examples for using socat (and filan)
// Examples for using socat (and filan)
//"$" means normal user, "#" requires privileges, "//" starts a comment
///////////////////////////////////////////////////////////////////////////////
// similar to netcat
// connect to 10.1.1.1 on port 80 and relay to and from stdio
@dusekdan
dusekdan / XPath selector - All URLs from HTML attributes
Last active November 22, 2021 12:52
Extracts URLs from HTML attributes with type of URI.
-- When fed to XPath selects all URLs from HTML document
-- from within HTML attributes designated to hold URL
-- One-line version
"//a/@href | //applet/@codebase | //area/@href | //base/@href | //blockquote/@cite | //body/@background | //del/@cite | //form/@action | //frame/@src | //frame/@longdesc | //head/@profile | //iframe/@longdesc | //iframe/@url | //img/@longdesc | //img/@usemap | //input/@src | //input/@usemap | //ins/@cite | //object/@classid | //object/@codebase | //object/@data | //object/@usemap | //q/@cite | //img/@src | //link/@href | //source/@src | //embed/@src | //script/@src | //audio/@src | //button/@formaction | //command/@icon | //html/@manifest | //input/@formaction | //video/@poster | //video/@src"
-- Multi-line version (readable)
"//a/@href
| //applet/@codebase
| //area/@href
| //base/@href
@SaltwaterC
SaltwaterC / README.md
Last active March 3, 2024 23:21
OpenWrt support for Netgear WNR1000v2

Install

As usual, use it at your own risk. I am not to be held responsible for your actions.

Supported devices: WNR1000v2 (tested by me), WNR1000v2-VC (provided by Comcast for free; tested by Douglas Fraser)

Notice: Upgrade WNR1000v2 to the latest factory firmware: 1.1.2.58. Otherwise, the power LED may not behave properly.

You need to place the device into failsafe mode. For booting into failsafe mode, you need to power up the device while holding the reset button with a pin. The power LED should have an amber colour. Hold the button until it is starting to flash green. It starts to flash green after it flashes the amber LED for six times. After that, the device is in failsafe mode, accepting a firmware via its TFTP server. The device should respond to pings at 192.168.1.1, although the responses may be malformed.

@tehprofessor
tehprofessor / watir_phantomjs_user_agent_settings.rb
Created May 1, 2013 18:28
Configuring Watir to use a custom user agent with the PhantomJS driver. The user agent gem has been deprecated, and this functionality is not documented anywhere (obvious).
require 'watir-webdriver'
capabilities = Selenium::WebDriver::Remote::Capabilities.phantomjs("phantomjs.page.settings.userAgent" => "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36")
driver = Selenium::WebDriver.for :phantomjs, :desired_capabilities => capabilities
browser = ::Watir::Browser.new driver
# Quick test to make sure it's set
browser.goto 'http://www.useragentstring.com/'
browser.textarea(:id => "uas_textfeld").value
@josevalim
josevalim / 0_README.md
Created September 13, 2012 21:52
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

@fgrehm
fgrehm / ree-1.8.7-2011.03
Created August 14, 2012 01:46
ruby-build REE definitions for Ubuntu 12.04
build_package_patched() {
# These three patches are included when RVM builds REE
cd source
wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/tcmalloc.patch'
wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/stdout-rouge-fix.patch'
wget 'https://github.com/wayneeseguin/rvm/raw/master/patches/ree/1.8.7/no_sslv2.diff'
patch -p1 < tcmalloc.patch
patch -p1 < stdout-rouge-fix.patch
patch -p1 < no_sslv2.diff
cd ..
@georgeredinger
georgeredinger / setup.md
Created June 23, 2012 23:14 — forked from leesmith/setup.md
Ruby on Rails development setup on Ubuntu 12.04 (vim, git, rbenv)

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

@Zapotek
Zapotek / js.demo.rb
Created December 4, 2011 17:01
V8 interpreter with basic DOM in Ruby using TheRubyRacer and Taka
require 'v8'
require 'open-uri'
require 'pp'
require 'ap'
require 'taka'
require 'ostruct'
#
# Monkey patch all elements to include a 'style' attribute
#