This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bmaddy@foo:~/src/sandbox/console$ rails c | |
Loading development environment (Rails 3.0.4) | |
ruby-1.8.7-p330 :001 > User.count | |
=> 0 | |
ruby-1.8.7-p330 :002 > User.order("name; delete from users;--").to_sql | |
=> "SELECT \"users\".* FROM \"users\" ORDER BY name; delete from users;--" | |
ruby-1.8.7-p330 :003 > User.order("?", "name; delete from users;--").to_sql | |
=> "SELECT \"users\".* FROM \"users\" ORDER BY ?, name; delete from users;--" | |
ruby-1.8.7-p330 :004 > User.order(["?", "name; delete from users;--"]).to_sql | |
=> "SELECT \"users\".* FROM \"users\" ORDER BY ?, name; delete from users;--" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function M(){}; | |
M.contResult = function(value){ | |
return function(cont){ | |
console.log('in result: ' + value); | |
return cont(value); | |
} | |
} | |
M.contBind = function(mValue, mFunc){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns prov.core | |
(:require [pallet.core] | |
[pallet.utils :as utils] | |
[pallet.phase :as phase] | |
[pallet.action.package :as package] | |
[pallet.compute :as compute] | |
[pallet.crate.ssh :as ssh] | |
[pallet.crate.automated-admin-user :as automated-admin-user])) | |
(def service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject prov "1.0.0-SNAPSHOT" | |
:description "FIXME: write description" | |
:dependencies [[org.cloudhoist/pallet "0.6.7"] | |
[org.cloudhoist/pallet-crates-all "0.5.0"] | |
[org.jclouds/jclouds-all "1.0.0"] | |
; Logging stuff that makes things super slow | |
;[org.slf4j/slf4j-api "1.6.1"] | |
;[ch.qos.logback/logback-core "1.0.0"] | |
;[ch.qos.logback/logback-classic "1.0.0"] | |
;[org.jclouds.driver/jclouds-jsch "1.0.0"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cljs-demo.http | |
(:require [cljs.nodejs :as node])) | |
(def http | |
(node/require "http")) | |
(defn handler [_ res] | |
(.writeHead res 200 (js-obj "Content-Type" "text/plain")) | |
(.end res "Hello World!\n")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns async-sieve.core | |
(:require [clojure.core.async :refer [chan go go-loop <! <!! >! filter<]])) | |
;; Sieve of Eratosthenes as described here: | |
;; http://swtch.com/~rsc/thread/ | |
;; Just to clarify, this isn't how core.async should be used, it's just a fun example: | |
;; "note that async channels are not intended for fine-grained computational parallelism" | |
;; - Rich Hickey (from http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html) | |
(defn prime-filter [in primes] | |
(go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.0.0p353 :018 > HOST = 'http://localhost:8080' | |
=> "http://localhost:8080" | |
2.0.0p353 :019 > client = Ldp::Client.new(HOST) | |
=> #<Ldp::Client:0x007f8f9f0c5860 @http=#<Faraday::Connection:0x007f8f9f0c5770 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.9.0"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuilder:0x007f8f9f0c4938 @handlers=[Faraday::Request::UrlEncoded, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTP:0x007f8f9f0c40c8 URL:http://localhost:8080/>, @proxy=nil>> | |
2.0.0p353 :020 > resource = Ldp::Resource.new(client, HOST + '/rest/node/to/update') | |
=> #<Ldp::Resource:0x007f8f9f0e8798 @client=#<Ldp::Client:0x007f8f9f0c5860 @http=#<Faraday::Connection:0x007f8f9f0c5770 @parallel_manager=nil, @headers={"User-Agent"=>"Faraday v0.9.0"}, @params={}, @options=#<Faraday::RequestOptions (empty)>, @ssl=#<Faraday::SSLOptions (empty)>, @default_parallel_manager=nil, @builder=#<Faraday::RackBuil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<http://localhost:8080/rest/node/to/update/fcr:export?format=jcr/xml> <http://www.w3.org/2000/01/rdf-schema#label> "jcr/xml" . | |
<http://localhost:8080/rest/node/to/update> a <http://www.w3.org/ns/ldp#Container>, | |
<http://www.w3.org/ns/ldp#Page>, | |
<http://fedora.info/definitions/v4/rest-api#resource>, | |
<http://fedora.info/definitions/v4/rest-api#object>; | |
<http://fedora.info/definitions/v4/repository#baseVersion> <http://localhost:8080/rest/jcr:system/jcr:versionStorage/9b/e0/ec/9be0eca8318518d305dde3151233904638129868/jcr:rootVersion>; | |
<http://fedora.info/definitions/v4/repository#created> "2014-02-04T01:59:02.242Z"; | |
<http://fedora.info/definitions/v4/repository#createdBy> "bypassAdmin"; | |
<http://fedora.info/definitions/v4/repository#hasParent> <http://localhost:8080/rest/node/to>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bmaddy@foo:~/src/sandbox/2014/fedora_lens[master]$ curl -X GET -H "Content-Type: text/turtle" "http://localhost:8080/rest/node/to/update" | |
<http://localhost:8080/rest/node/to/update> <http://fedora.info/definitions/v4/rest-api#hasAccessRoles> <http://localhost:8080/rest/node/to/update/fcr:accessroles> . | |
<http://localhost:8080/rest/node/to/update/fcr:export?format=jcr/xml> <http://www.w3.org/2000/01/rdf-schema#label> "jcr/xml"^^<http://www.w3.org/2001/XMLSchema#string> . | |
<http://localhost:8080/rest/node/to/update> <http://fedora.info/definitions/v4/rest-api#exportsAs> <http://localhost:8080/rest/node/to/update/fcr:export?format=jcr/xml> ; | |
<http://fedora.info/definitions/v4/rest-api#hasVersions> <http://localhost:8080/rest/node/to/update/fcr:versions> ; | |
<http://www.w3.org/ns/ldp#nextPage> <http://localhost:8080/rest/node/to/update?limit=-1&offset=-1> ; | |
<http://www.w3.org/ns/ldp#firstPage> <http://localhost:8080/rest/node/to/update?limit=-1&offset=0> ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attribute :subject, [Lenses.get_predicate(RDF::DC11.subject), Lenses.literals_to_strings, Lenses.select(only_foos)] | |
attribute :subject2, [Lenses.get_predicate(RDF::DC11.subject), Lenses.literals_to_strings, Lenses.select(only_bars)] | |
def select(test) | |
Lens[ | |
get: lambda do |source_values| | |
raise unless source_values.is_a?(Set) | |
source_values.select{|v| test(v)} | |
end, | |
put: lambda do |source_values, new_values| |
OlderNewer