Skip to content

Instantly share code, notes, and snippets.

View fourier's full-sized avatar

fourier fourier

View GitHub Profile
#include <stdio.h>
struct point_t {
float x;
float y;
};
static point_t point = {
.x = 0.5,
.y = -1.3,
};
@fourier
fourier / gist:b9a79ebcaeb241c01a0c
Created September 18, 2014 08:21
request for log entries
curl http://marauder.tiro.se/api/log\?start\=2014-09-01\&end\=2014-09-18 -H "Authorization: Basic alexey@veroveli.com:alexey123"
{
"startDate" : "2014-09-01T04:00:00Z",
"endDate" : "2014-09-18T04:00:00Z",
"entries" : [ {
"id" : 45,
"customer" : 6,
"project" : null,
"workcode" : null,
"user" : 93,
@fourier
fourier / gist:2230e5d881f26dab69bf
Created September 18, 2014 08:23
XML Description of the request and response
<request proto:name="LogEntries"
proto:url="http://marauder.tiro.se/api/log"
proto:auth="true"
proto:response="LogEntriesInterval">
<cgn:field cgn:name="start" cgn:type="string" />
<cgn:field cgn:name="end" cgn:type="string" />
</request>
<?xml version="1.0" encoding="UTF-8"?>
<objects cgn:package="com.mycompany.example"
cgn:read-only="false"
jcgn:builder="true"
jcgn:parcelable="true">
<cgn:object cgn:name="WorkPackage">
<cgn:field cgn:name="customer-id" cgn:type="long" />
<cgn:field cgn:name="workcode-id" cgn:type="long"/>
<cgn:field cgn:name="project-id" cgn:type="long"/>
<jcgn:source>
;; Swap "C-u" and "C-x", so it's easier to type on Dvorak layout
(keyboard-translate ?\C-u ?\C-x)
(keyboard-translate ?\C-x ?\C-u)
webfingering hackernews@pod.jpope.org, it is not known or needs updating
Getting: https://pod.jpope.org/.well-known/host-meta for hackernews@pod.jpope.org
Getting: http://diaspora.jpope.org/webfinger?q=hackernews@pod.jpope.org for hackernews@pod.jpope.org
webfingering hackernews@pod.jpope.org, it is not known or needs updating
Getting: https://pod.jpope.org/.well-known/host-meta for hackernews@pod.jpope.org
Getting: http://diaspora.jpope.org/webfinger?q=hackernews@pod.jpope.org for hackernews@pod.jpope.org
webfingering hackernews@pod.jpope.org, it is not known or needs updating
Getting: https://pod.jpope.org/.well-known/host-meta for hackernews@pod.jpope.org
Getting: http://diaspora.jpope.org/webfinger?q=hackernews@pod.jpope.org for hackernews@pod.jpope.org
webfingering hackernews@pod.jpope.org, it is not known or needs updating
pp/workers/fetch_webfinger.rb:10:in `perform'
2015-02-19T18:50:21Z 4793 TID-1bx39s Workers::FetchWebfinger JID-82fe38b8d0888551b4b4d2e9 INFO: start
2015-02-19T18:50:22Z 4793 TID-1bx39s Workers::FetchWebfinger JID-82fe38b8d0888551b4b4d2e9 INFO: fail: 0.98 sec
2015-02-19T18:50:22Z 4793 TID-1bx39s WARN: {"retry"=>10, "queue"=>"socket_webfinger", "backtrace"=>15, "class"=>"Workers::FetchWebfinger", "args"=>["hackernews@pod.jpope.org"], "jid"=>"82fe38b8d0888551b4b4d2e9", "enqueued_at"=>1424370340.498326, "locale"=>"en", "error_message"=>"account in profile() and account requested (hackernews@pod.jpope.org) do not match", "error_class"=>"RuntimeError", "failed_at"=>1424370342.2960591, "retry_count"=>6, "error_backtrace"=>["lib/webfinger_profile.rb:24:in `set_fields'", "lib/webfinger_profile.rb:8:in `initialize'", "lib/webfinger.rb:84:in `new'", "lib/webfinger.rb:84:in `webfinger_profile'", "lib/webfinger.rb:108:in `make_person_from_webfinger'", "lib/webfinger.rb:58:in `create_or_update_person_from_webfinger_profile
Webfinger.new('hackernews@pod.jpope.org').fetch
Person Load (5.4ms) SELECT "people".* FROM "people" WHERE "people"."diaspora_handle" = 'hackernews@pod.jpope.org' LIMIT 1
RuntimeError: account in profile() and account requested (hackernews@pod.jpope.org) do not match
from /home/diaspora/diaspora/lib/webfinger_profile.rb:24:in `set_fields'
from /home/diaspora/diaspora/lib/webfinger_profile.rb:8:in `initialize'
from /home/diaspora/diaspora/lib/webfinger.rb:84:in `new'
from /home/diaspora/diaspora/lib/webfinger.rb:84:in `webfinger_profile'
from /home/diaspora/diaspora/lib/webfinger.rb:108:in `make_person_from_webfinger'
from /home/diaspora/diaspora/lib/webfinger.rb:58:in `create_or_update_person_from_webfinger_profile!'
from /home/diaspora/diaspora/lib/webfinger.rb:18:in `fetch'
(defvar *feed* "https://www.eff.org/rss/updates.xml")
(defun parse-feed (status)
(let* ((start (- (search-forward "<?xml") 5))
(parsed (libxml-parse-xml-region start (buffer-size)))
(channel (nth 2 *contents*)))
(dolist (x channel)
(when (and (listp x) (equal (car x) 'item))
(dolist (y x)
(when (and (listp y) (equal (car y) 'title))
# su - postgres
$ psql
postgres=# CREATE USER diaspora WITH PASSWORD 'myubercoolpassword';
postgres=# CREATE DATABASE diaspora OWNER diaspora;
postgres=# ALTER USER diaspora CREATEDB;