example on how to use mechanize with cookie jars, basically:
agent.cookie_jar.save_as "cookies.yml"
agent.cookie_jar.load "cookies.yml"
to try it:
- download this zip
| // sanguinololu fix - https://code.google.com/p/sanguino/issues/detail?id=27 | |
| #if ARDUINO >= 100 | |
| #if defined(__AVR_ATmega644P__) | |
| //#include "WProgram.h" | |
| //#else | |
| #include "Arduino.h" | |
| #endif | |
| //#else | |
| //#include "WProgram.h" |
| // stl generation | |
| part1 = true; // (switch to false for part2), you'll need both for a phone wheel mount | |
| // parts configuration | |
| // phone size | |
| ph_x = 62.4; | |
| ph_y = 134.1; | |
| ph_z = 12.1; |
| require 'celluloid' | |
| DB = { count: 0 } | |
| class Actor | |
| include Celluloid | |
| def do_stuff | |
| # sleep 1 |
| <meta name="viewport" content="width=device-width"> | |
| <script> | |
| var main = function(){ | |
| log("hello world") | |
| } | |
| var log = function(string){ | |
| var body = document.getElementsByTagName("body")[0] | |
| body.innerHTML = body.innerHTML+string+"<br>" | |
| } |
| # run ruby lapse_rename.rb | |
| # then: | |
| # avconv -f image2 -i lapse_%04d.jpg -s hd1080 -threads 8 out.mp4 | |
| files = Dir.glob("*.JPG") | |
| files.sort.each_with_index do |file, idx| | |
| idx += 1 |
| #! /usr/bin/ruby | |
| # jsdl | |
| # | |
| # download js libraries for you | |
| # | |
| # usage: jsdl jquery | |
| # configs |
| class AppDelegate | |
| def application(application, didFinishLaunchingWithOptions:launchOptions) | |
| player_controller = MainController.alloc.init | |
| window = UIWindow.alloc.initWithFrame UIScreen.mainScreen.bounds | |
| window.rootViewController = player_controller | |
| window.rootViewController.wantsFullScreenLayout = true | |
| window.makeKeyAndVisible | |
| true | |
| end | |
| end |
| # Mhash | |
| # | |
| # defines accessors methods for each hash key | |
| # | |
| # | |
| # why? | |
| # to enhance syntactic sugar and to let the refactoring transition to a real object easier | |
| # | |
| # usage: | |
| # |
| # obfuscates the db removing sensible values | |
| # ruby obfuscate.rb | |
| # mysqldump -u root gbc > gbc_safe.sql | |
| # tar cvfz gbc_safe.tgz gbc_safe.sql | |
| require 'bundler/setup' | |
| Bundler.require :default | |
| class Obfuscate |