Skip to content

Instantly share code, notes, and snippets.

View l1x's full-sized avatar
🏠
Working from home

Istvan l1x

🏠
Working from home
View GitHub Profile
@l1x
l1x / riak.txt
Created February 20, 2014 05:07
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2328435420 errors:0 dropped:0 overruns:0 frame:2
top - 21:06:40 up 105 days, 9:56, 1 user, load average: 43.88, 25.75, 10.66
Tasks: 506 total, 1 running, 505 sleeping, 0 stopped, 0 zombie
Cpu0 : 21.2%us, 33.3%sy, 0.0%ni, 35.1%id, 6.6%wa, 0.0%hi, 3.8%si, 0.0%st
Cpu1 : 16.3%us, 34.3%sy, 0.0%ni, 36.4%id, 7.8%wa, 0.0%hi, 5.3%si, 0.0%st
Cpu2 : 17.2%us, 29.3%sy, 0.0%ni, 47.5%id, 6.1%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 : 13.9%us, 29.9%sy, 0.0%ni, 49.7%id, 6.5%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu4 : 13.0%us, 26.7%sy, 0.0%ni, 54.5%id, 5.8%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu5 : 12.9%us, 26.8%sy, 0.0%ni, 55.3%id, 5.1%wa, 0.0%hi, 0.0%si, 0.0%st
@l1x
l1x / perf.rb
Created February 20, 2014 06:00
require 'riak'
require 'pp'
require 'uuid'
Riak.disable_list_keys_warnings = true
# Automatically balance between multiple nodes
client = Riak::Client.new(
:protocol => "pbc",
:nodes => [
git checkout -b bug/fix-description 1.0.x
#do stuff
#gc --amend -a
git checkout 1.0.x
git merge bug/fix-description
git tag -a -m "1.0.1 release" 1.0.1
#merging back to master
git checkout -b merge/1.0.x-master master
git merge 1.0.x
//http://amplab.github.io/graphx/
// Connect to the Spark cluster
val sc = new SparkContext("spark://master.amplab.org", "research")
// Load my user data and prase into tuples of user id and attribute list
val users = sc.textFile("hdfs://user_attributes.tsv")
.map(line => line.split).map( parts => (parts.head, parts.tail) )
// Parse the edge data which is already in userId -> userId format
val followerGraph = Graph.textFile(sc, "hdfs://followers.tsv")
@l1x
l1x / solr
Created February 28, 2014 05:34
http://10.0.3.81:10018/search/rr_index?q=*:*&wt=json&fq=image_id:BK.jpg*&fl=image_id
SELECT DISTINCT *
WHERE {
?city rdf:type dbpedia-owl:City ;
rdfs:label ?label;
dbpedia-owl:abstract ?abstract ;
dbpedia-owl:populationTotal ?pop ;
dbpedia-owl:country ?country .
FILTER ( lang(?abstract) = 'en' && lang(?label) = 'en' && ?pop > 50000)
} ORDER BY ?pop
@l1x
l1x / cities.clj
Last active August 29, 2015 13:56
(require '[clojure.data.json :as json])
(defn uuid
"Returns a new java.util.UUID as string"
[]
(str (java.util.UUID/randomUUID)))
(def cities (slurp "cities.pp.json"))
(def cities-json (json/read-str cities))
(map #(spit (str "t/" (uuid) ".json") (json/write-str %)) cities-json)
(map #(get-in % ["label" "value"]) cities-json)
#creating a new schema
#
curl -XPUT -d @sch_cities.xml -H "Content-Type: application/xml" \
'http://10.0.3.81:10018/search/schema/sch_cities'
curl -XPUT -i "http://10.0.3.81:10018/search/index/idx_cities" \
-H'content-type:application/json' \
-d'{"schema":"sch_cities"}'
SELECT locktype, relation::regclass, mode, transactionid AS tid,
virtualtransaction AS vtid, pid, granted
FROM pg_catalog.pg_locks l LEFT JOIN pg_catalog.pg_database db
ON db.oid = l.database WHERE (db.datname = 'sandbox' OR db.datname IS NULL)
AND NOT pid = pg_backend_pid();
%%old
content_types_accepted(RD, S) ->
Types = [{"application/xml", store_schema}],
{Types, RD, S}.
%%new
content_types_accepted(RD, S) ->
Types = [{"application/xml", store_schema}, {"text/xml", store_schema}],
{Types, RD, S}.