Skip to content

Instantly share code, notes, and snippets.

adb push asroot2 /data/local/
adb shell chmod 0755 /data/local/asroot2
adb shell /data/local/asroot2 /system/bin/sh
adb shell
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
# cd /system/bin
# cat sh > su
# chmod 4755 su
# exit
adb reboot
// compile this as
// g++ -o read read.cpp -lpcre++
#include <iostream>
#include <fstream>
#include <pcre++.h>
using namespace std;
using namespace pcrepp;
#!/usr/bin/ruby
require 'gems/environment'
require 'minitest/unit'
require 'minitest/spec'
require 'rack/test'
require 'sinatra/base'
ENV['RACK_ENV'] = 'test'
CPP - Using dbixx
bharanee@tardis ~$ /usr/bin/time -v ./dbicpp > /dev/null
Command being timed: "./dbicpp"
User time (seconds): 0.72
System time (seconds): 0.20
Percent of CPU this job got: 28%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:03.22
Perl - Using DBI
#include <dbixx/dbixx.h>
#include <unistd.h>
#include <iostream>
using namespace dbixx;
using namespace std;
int main() {
nice(19);
try {
#!/usr/bin/ruby
require 'gems/environment'
require 'rack'
require 'thin'
require 'em-http'
module Rack
module TestServer
def self.run app, middlewares=[], &block
require 'rack'
require 'thin'
module Rack
module Test
class App
# Attempt to run a Rack app server instance in the same process as the a
# 'work' block. Came about because you can't see an unsaved DB transaction
# inside the Rack app if it happens in another process.
#
module Swift
class Migrations
def initialize adapter
@adapter = adapter.kind_of?(Adapter) ? adapter : Swift.db(adapter)
end
def typemap
{ Integer => 'integer', String => 'varchar(255)', Float => 'float', Time => 'timestamp' }
end
def migrate_up! model
fields = model.properties.map {|p| "#{p.field} #{typemap[p.type]}" }.join(',')
diff --git a/examples/orm.rb b/examples/orm.rb
index bfb475d..1fb9717 100755
--- a/examples/orm.rb
+++ b/examples/orm.rb
@@ -1,5 +1,6 @@
#!/usr/bin/env ruby
require_relative '../lib/swift-orm'
+require_relative '../lib/swift-orm/types'
require 'etc'
require 'pp'
#!/usr/bin/ruby
class Flash < Hash
class List < Array
def to_s
map {|v| "<li>#{v}</li>" }.join('')
end
end
def []= k, v
super(k, List.new(fetch(k, []) + [v]))