mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-29 12:15:43 +03:00
sweeping
This commit is contained in:
parent
7c9a506b84
commit
bfd52f9e32
206
ape/bit.hoon
206
ape/bit.hoon
@ -1,206 +0,0 @@
|
||||
::
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/- talk, bit-api
|
||||
/+ talk, sole, http
|
||||
!:
|
||||
:::: sivtyv-barnel
|
||||
:: be sure to have oauth2-code markk
|
||||
[talk bit-api .]
|
||||
|%
|
||||
++ axle
|
||||
$: cred=(unit ,[app-secret=@t client-id=@t])
|
||||
oauth-code=(unit ,@t)
|
||||
auth=(unit ,[access=@t refresh=@t])
|
||||
contacts=(map ,@t ,@t)
|
||||
outgoing=(map ship ,@t) incoming=(map ,@t ship)
|
||||
==
|
||||
++ move ,[bone note]
|
||||
++ hapt ,[ship path]
|
||||
++ note
|
||||
$% [%send wire [ship term] %poke mesa]
|
||||
[%them wire (unit hiss)]
|
||||
[%hiss wire mark bit-any]
|
||||
==
|
||||
++ gift
|
||||
$% [%nice ~]
|
||||
[%mean ares]
|
||||
==
|
||||
++ sign
|
||||
$% [%thou p=httr]
|
||||
[%unto %coup p=(unit tang)]
|
||||
==
|
||||
++ mesa
|
||||
$% [%bit-addr-request ~]
|
||||
[%bit-addr-made @t]
|
||||
[%talk-command command]
|
||||
==
|
||||
--
|
||||
::
|
||||
!:
|
||||
|_ [hid=bowl vat=axle]
|
||||
:: ++ prep ~&(%bit-prep-wipe ,_`.)
|
||||
++ return [*(list move) .]
|
||||
++ redirect-uri [hostname `/~~/bit/fab ~]
|
||||
++ hostname ^- hart
|
||||
?+ (clan our.hid) !!
|
||||
%czar [| ?+(our.hid `8.443 %~fyr `8.444) `/localhost]
|
||||
%duke [| `8.444 `/org/urbit/(crip +:<our.hid>)]
|
||||
==
|
||||
++ auth-url
|
||||
%+ weld "https://sandbox.coinbase.com/oauth/authorize"
|
||||
%- tail:earn :~
|
||||
'response_type'^%code
|
||||
'client_id'^client-id:(need cred.vat)
|
||||
'redirect_uri'^(crip (earn redirect-uri))
|
||||
'scope'^'user balance buy sell send transactions addresses'
|
||||
'meta[send_limit_amount]'^'1'
|
||||
'meta[send_limit_curency]'^'BTC'
|
||||
'meta[send_limit_period]'^'day'
|
||||
==
|
||||
++ old-api
|
||||
|= [pour-path=wire end-point=path req=$|(%get [%post p=json])]
|
||||
^- move
|
||||
%^ send:http ost.hid pour-path
|
||||
[/com/coinbase/api v1/end-point req ~ ['access_token' access:(need auth.vat)]~]
|
||||
::
|
||||
++ api-call
|
||||
|= [res=mark req=bit-api-call] ^+ return
|
||||
~| %missing-access-token
|
||||
[[ost.hid %hiss / res bit-api-call/[access:(need auth.vat) req]]~ +>.$]
|
||||
::
|
||||
++ print |=(msg=tape [[(publish [%lin & (crip msg)]~)]~ +>.$])
|
||||
++ callback-uri [hostname [`%json /~/to/[dap.hid]/json] ~[anon/'' wire/'/']]
|
||||
++ poke-auth
|
||||
|= arg=[secr=cord id=cord]
|
||||
=. cred.vat `arg
|
||||
=+ prl=`purl`(need (epur (crip auth-url)))
|
||||
:_ +>.$
|
||||
:- %- publish
|
||||
:~ [%lin & 'secret and client id saved successfully']
|
||||
[%lin & 'please click on the url below to continue authentication']
|
||||
[%url prl ~]
|
||||
==
|
||||
~
|
||||
::
|
||||
++ sigh-tang |=([* err=tang] (mean err))
|
||||
++ send-friend :: inter-app interface
|
||||
|= [way=wire his=ship mez=$%([%bit-addr-request ~] [%bit-addr-made @t])]
|
||||
^- move
|
||||
[ost.hid %send way [his dap.hid] %poke mez]
|
||||
::
|
||||
++ poke-bit-send |=(req=bit-send (api-call %bit-transaction send/req))
|
||||
++ sigh-bit-transaction
|
||||
|=([* trid=@t] (print "transaction success {(trip trid)}"))
|
||||
::
|
||||
++ poke-bit-ship-send :: send to ship
|
||||
|= [to=ship amount=@t]
|
||||
=. outgoing.vat (~(put by outgoing.vat) to amount)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
(send-friend /sent to %bit-addr-request ~)
|
||||
++ poke-bit-addr-request :: give your address to receive bit
|
||||
|= ~ :: gen new address with callback
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%+ old-api /addr-request/(scot %p src.hid)
|
||||
:+ /addresses %post
|
||||
%+ joba %address
|
||||
%- jobe :~
|
||||
label/(jape "address for {<src.hid>}")
|
||||
'callback_url'^(jape (earn callback-uri))
|
||||
==
|
||||
::
|
||||
++ pour-addr-request :: send new address to sender
|
||||
|= [pax=path rez=json]
|
||||
=+ adr=(need ((ot address/so ~):jo rez))
|
||||
=+ his=(slav %p +<.pax)
|
||||
~! incoming.vat
|
||||
=. incoming.vat
|
||||
(~(put by incoming.vat) adr his)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
(send-friend [%message ~] his %bit-addr-made adr)
|
||||
::
|
||||
++ poke-bit-addr-made :: receive address for sending
|
||||
|= addr=@t
|
||||
=+ amount=(~(got by outgoing.vat) src.hid) :: get amount to send
|
||||
(api-call %bit-transaction txt-send/[addr amount])
|
||||
::
|
||||
++ poke-oauth2-code
|
||||
|= code=cord
|
||||
=. oauth-code.vat
|
||||
[~ code]
|
||||
?< ?=(~ cred.vat)
|
||||
=+ req=[code [client-id app-secret]:u.cred.vat redirect-uri]
|
||||
[[ost.hid %hiss / %oauth-tokens bit-get-token/req]~ +>.$]
|
||||
::
|
||||
++ sigh-oauth-tokens
|
||||
|= [wire toke=[access=@t refresh=@t]]
|
||||
=.(auth.vat `toke (print "authenticated."))
|
||||
::
|
||||
++ poke-buy
|
||||
|=(arg=[amount=@t currency=@t] ?<(=(amount.arg ~) (api-call %json %buy arg)))
|
||||
++ poke-sell
|
||||
|=(arg=[amount=@t currency=@t] ?<(=(amount.arg ~) (api-call %json %sell arg)))
|
||||
++ sigh-json |=([* a=json] ~&(a return))
|
||||
++ poke-list |=(~ (api-call %bit-accounts %list ~))
|
||||
++ sigh-bit-accounts |=([* acc=bit-accounts] ~&(accounts=acc return))
|
||||
++ poke-send-raw
|
||||
|= arg=[to=@t amone=(unit ,@t) cur=(unit ,@t) amtwo=(unit ,@t) nt=(unit ,@t)]
|
||||
=+ adr=?~((~(get by contacts.vat) to.arg) to ~&('contact-exists' (~(get by contacts.vat) to.arg)))
|
||||
=+ ^= info
|
||||
?~ cur.arg
|
||||
[to/s/to.arg amount/s/(need amone.arg) ~]
|
||||
?~ nt.arg
|
||||
[to/s/to.arg 'amount_currency_iso'^s/(need cur.arg) 'amount_string'^s/(need amtwo.arg) ~]
|
||||
[to/s/to.arg amount/s/(need amtwo.arg) 'amount_string'^s/(need amtwo.arg) ~]
|
||||
=+ ^= pst
|
||||
(jobe transaction/(jobe info) ~)
|
||||
[[(old-api /send /transactions/'send_money' %post pst) ~] +>.$]
|
||||
::
|
||||
++ poke-json
|
||||
|= arg=json
|
||||
~& arg
|
||||
=+ [adr amo]=(need %.(arg (ot address/so amount/no ~):jo))
|
||||
=+ frm=(~(get by incoming.vat) adr)
|
||||
(print "just received {(trip amo)} BTC from {<frm>}")
|
||||
::(old-api /get-id /transactions/[transaction-id] %get)
|
||||
++ pour-get-id :: display transaction info
|
||||
|= [pax=path rez=json]
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
!!
|
||||
::
|
||||
++ thou
|
||||
|= [way=wire res=httr]
|
||||
?+ -.way !!
|
||||
%message `+>.$
|
||||
?(%addr-request %get-id)
|
||||
~| 'must receive a 200'
|
||||
~| res
|
||||
?> =(200 p.res)
|
||||
%- ?-(-.way %addr-request pour-addr-request, %get-id pour-get-id)
|
||||
[way (rash q:(need r.res) apex:poja)]
|
||||
==
|
||||
::
|
||||
++ publish
|
||||
|= act=(list speech)
|
||||
^- move
|
||||
=+ ^= thotz
|
||||
%+ turn act
|
||||
|= sp=speech ^- thought
|
||||
=+ ^= tail
|
||||
:- ^- audience
|
||||
:+ :- `partner`[%& our.hid ?+((clan our.hid) !! %czar %court, %duke %porch)]
|
||||
^- (pair envelope delivery)
|
||||
[`envelope`[& ~] %pending]
|
||||
~
|
||||
~
|
||||
`statement`[now.hid ~ sp]
|
||||
:- `@`(sham eny.hid tail)
|
||||
tail
|
||||
[ost.hid %send /auth [our.hid %talk] %poke [%talk-command %publish thotz]]
|
||||
--
|
649
ape/cloud.hoon
649
ape/cloud.hoon
@ -1,649 +0,0 @@
|
||||
:: digital ocean fleet management
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/- talk
|
||||
::
|
||||
::
|
||||
:::: sivtyv-barnel
|
||||
::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: data structures ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
!:
|
||||
[talk .]
|
||||
|%
|
||||
++ instance
|
||||
$: plat=?(%do %gce) name=@t id=@t status=@t created=@da snapshot=name=@t ::disk=@u region=@t
|
||||
::ip=(list ,@if)
|
||||
==
|
||||
++ image
|
||||
$: plat=?(%do %gce) name=@t id=@t
|
||||
==
|
||||
++ create-req-do
|
||||
$:
|
||||
name=@t ::region=@t
|
||||
size=@t image=@t ssh=(list cord)
|
||||
backups=(unit ,?) ipv6=(unit ,?)
|
||||
private-networking=(unit ,?) user-data=(unit ,@t)
|
||||
==
|
||||
++ create-req-gce ,[project=@t zone=@t name=@t machine-type=@t]
|
||||
++ axle
|
||||
$: auth=[do=keys gce=keys] toke=[do=tokens gce=tokens]
|
||||
insts=(map ,@t instance) images=(map [,[@t @t] image])
|
||||
==
|
||||
++ keys ,[authc=(unit ,@t) client-secret=(unit ,@t)]
|
||||
++ tokens ,[access=@t refresh=@t]
|
||||
++ move ,[bone card]
|
||||
++ card
|
||||
$% [%diff %json json]
|
||||
[%wait wire @da]
|
||||
[%send wire [ship term] %poke %talk-command command]
|
||||
[%them wire (unit hiss)]
|
||||
==
|
||||
++ droplet-action
|
||||
$% [%start ~]
|
||||
[%stop ~]
|
||||
[%reboot ~]
|
||||
[%delete ~]
|
||||
[%snapshot p=@t]
|
||||
==
|
||||
++ cloud-command
|
||||
$% [%action id=@t name=@t act=droplet-action]
|
||||
[%create-do p=json]
|
||||
[%create-gce p=json]
|
||||
==
|
||||
--
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: miscellaneous functions ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
!:
|
||||
|%
|
||||
++ auth-queries
|
||||
|= code=cord
|
||||
:~ 'grant_type'^'authorization_code'
|
||||
'code'^code
|
||||
:- 'client_id'
|
||||
'd8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f'
|
||||
'redirect_uri'^'http://localhost:8443/cloud/fab'
|
||||
==
|
||||
::
|
||||
++ parse-iso8601
|
||||
=< (cook to-time (parsf ;"{parse-day}T{parse-seconds}{parse-zone}"))
|
||||
|%
|
||||
++ to-time
|
||||
|= [[y=@u m=@u d=@u] t=[h=@u m=@u s=@u ms=@u] [syn=? zh=@u zm=@u]]
|
||||
^- @da
|
||||
%- year
|
||||
^- date
|
||||
=: h.t ?:(syn (sub h.t zh) (add h.t zh))
|
||||
m.t ?:(syn (sub m.t zm) (add m.t zm))
|
||||
==
|
||||
[[& y] m d h.t m.t s.t (div (mul ms.t 0x1.0000) 1.000) ~]
|
||||
++ parse-day (parsf ;"{dem}\-{dem}\-{dem}")
|
||||
++ parse-seconds (parsf ;"{dem}:{dem}:{dem}{(optional ;~(pfix dot dem))}")
|
||||
++ optional |*(fel=_rule ;~(pose fel (easy 0)))
|
||||
++ parse-zone
|
||||
;~ pose
|
||||
(cold [& 0 0] (jest 'Z'))
|
||||
(parsf ;"{parse-zone-sign}{dem}:{dem}")
|
||||
==
|
||||
++ parse-zone-sign ;~(plug ;~(pose (cold & lus) (cold | hep)))
|
||||
--
|
||||
++ parse-cloud-command
|
||||
=+ jo
|
||||
%- of :~
|
||||
[%create-gce some]
|
||||
[%create-do some]
|
||||
::[%create-gce some]
|
||||
:- %action
|
||||
(ot id/so name/so act/parse-droplet-action ~)
|
||||
==
|
||||
++ parse-droplet-action
|
||||
=> jo
|
||||
%- of :~
|
||||
[%start ul]
|
||||
[%stop ul]
|
||||
[%reboot ul]
|
||||
[%delete ul]
|
||||
[%snapshot so]
|
||||
==
|
||||
++ key-do
|
||||
(mo [%start 'power_on'] [%stop 'shutdown'] [%reboot 'power_cycle'] ~)
|
||||
::
|
||||
++ adapter-do
|
||||
|= a=cord
|
||||
(~(got by key-do) a)
|
||||
::
|
||||
++ parse-ip-do
|
||||
=> jo
|
||||
%- ot
|
||||
:_ ~ v4/(ar (ot 'ip_address'^(su lip:ag) ~))
|
||||
::
|
||||
++ parse-ip-gce
|
||||
=> jo
|
||||
%+ cu |=(a=(list (list ,@if)) `(list ,@if)`(zing a))
|
||||
(ar (ot 'accessConfigs'^(ar (ot 'natIP'^(su lip:ag) ~)) ~))
|
||||
::
|
||||
++ tail-url
|
||||
|= a=cord
|
||||
-:(flop q.q:(need (epur a)))
|
||||
::
|
||||
++ parse-region
|
||||
=> jo
|
||||
(ot name/so ~)
|
||||
::
|
||||
++ parse-id-text
|
||||
|= jon=json
|
||||
?.(?=([?(%n %s) *] jon) ~ (some p.jon))
|
||||
::
|
||||
++ create-do-body
|
||||
|= $: name=@t ::region=@t
|
||||
size=@t image=@t ssh-keys=(list cord)
|
||||
backups=(unit ,?) ipv6=(unit ,?) private-networking=(unit ,?) user-data=(unit ,@t)
|
||||
==
|
||||
%- jobe
|
||||
:~ name/s/name ::region/s/region
|
||||
size/s/size image/s/image ::(jone image)
|
||||
backups/?~(backups ~ b/u.backups) ipv6/?~(ipv6 ~ b/u.ipv6)
|
||||
'user_data'^?~(user-data ~ s/u.user-data) 'private_networking'^?~(private-networking ~ b/u.private-networking)
|
||||
==
|
||||
::
|
||||
++ convert-do
|
||||
|= a=?(%start %stop %reboot %snapshot)
|
||||
?- a
|
||||
%start
|
||||
'power_on'
|
||||
%stop
|
||||
'shutdown'
|
||||
%reboot
|
||||
'power_cycle'
|
||||
%snapshot
|
||||
'snapshot'
|
||||
==
|
||||
::
|
||||
++ instance-to-json
|
||||
|= a=(list instance)
|
||||
^- json
|
||||
%+ joba 'instances'
|
||||
:- %a
|
||||
%+ turn a
|
||||
|= instance
|
||||
^- json
|
||||
%- jobe
|
||||
:~ name/`json`s/name
|
||||
id/s/id
|
||||
status/s/status
|
||||
created/s/(crip (dust (yore created)))
|
||||
::region/s/region
|
||||
snapshot/s/snapshot
|
||||
::disk/`json`(jone disk)
|
||||
::ip/a/(turn ip |=(a=@if s/(rsh 3 1 (scot %if a))))
|
||||
==
|
||||
++ map-to-list
|
||||
|= a=(map [,[@t @t] image])
|
||||
^- liz=(list image)
|
||||
%+ turn (~(tap by a) *(list ,[[@t @t] image]))
|
||||
|=(a=[[@t @t] image] `image`+.a)
|
||||
::
|
||||
++ image-to-json
|
||||
|= a=(list image)
|
||||
%+ joba 'images'
|
||||
:- %a
|
||||
%+ turn a
|
||||
|= image
|
||||
^- json
|
||||
%- jobe
|
||||
:~ name/s/name id/s/id ==
|
||||
--
|
||||
::::::::::::::::
|
||||
:: main door ::
|
||||
::::::::::::::::
|
||||
!:
|
||||
|_ [bowl vat=axle]
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: miscellaneous arms that have to be in main door for scope reasons ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
::
|
||||
::++ prep ,_`.
|
||||
::
|
||||
++ thou
|
||||
|= [pour-path=path resp=?(httr *)]
|
||||
^- [(list move) _+>.$]
|
||||
~& unhandled-pour-path/resp
|
||||
:_ +>.$ ~
|
||||
++ httpreq
|
||||
|= $: pour-path=wire :: must be in main door because of scope
|
||||
domain=(list cord) end-point=path
|
||||
req-type=$?(%get %delt [%post json]) headers=math
|
||||
queries=quay
|
||||
==
|
||||
^- move
|
||||
=+ ^- parsed-url=purl
|
||||
:+ ^= host-port :: ++hart
|
||||
:+ security=%.y
|
||||
port=~
|
||||
host=[%.y [path=[%com domain]]]
|
||||
endpoint=[extensions=~ point=end-point] :: ++pork,
|
||||
q-strings=queries :: ++quay
|
||||
=+ ^- request=hiss :: cast to hiss
|
||||
:- parsed-url
|
||||
?@ req-type
|
||||
[req-type headers ~]
|
||||
[%post headers ~ (tact (pojo +.req-type))]
|
||||
:^ ost %them pour-path
|
||||
`(unit hiss)`[~ request]
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: manage supscriptions and publish to talk ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ peer
|
||||
|= pax=path
|
||||
^- [(list move) _+>.$]
|
||||
:_ +>.$
|
||||
=+ lis=(~(tap by insts.vat))
|
||||
[ost %diff %json (instance-to-json (turn lis |=(a=[@t instance] +.a)))]~
|
||||
::
|
||||
++ spam
|
||||
|= jon=json
|
||||
%+ turn (~(tap by sup))
|
||||
|= [sub=bone @ pax=path]
|
||||
^- move
|
||||
[sub %diff %json jon]
|
||||
::
|
||||
++ publish
|
||||
|= [act=(list speech)]
|
||||
^- move
|
||||
=+ ^= spchz
|
||||
%+ turn act
|
||||
|= sp=speech
|
||||
=+ ^= tail
|
||||
:- ^- audience
|
||||
:+ :- `partner`[%& our ?+((clan our) !! %czar %court, %duke %porch)]
|
||||
^- (pair envelope delivery)
|
||||
[`envelope`[& ~] %pending]
|
||||
~
|
||||
~
|
||||
`statement`[now ~ sp]
|
||||
^- thought
|
||||
:- `@`(sham eny tail)
|
||||
tail
|
||||
=+ mez=[%talk-command [%publish `(list thought)`spchz]]
|
||||
[ost %send /pub [our %talk] %poke mez]
|
||||
++ thou-pub |=(~ :_(+>.$ ~))
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: authentication ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ poke-cloud-auth
|
||||
|= [cde=cord typ=cord]
|
||||
^- [(list move) _+>.$]
|
||||
?: =(%do typ)
|
||||
=. authc.do.auth.vat
|
||||
[~ cde]
|
||||
:_ +>.$ ~
|
||||
=. access.gce.toke.vat
|
||||
cde
|
||||
:_ +>.$
|
||||
:_ list-gce
|
||||
(publish [%lin & 'successfully authenticated to gce']~)
|
||||
::
|
||||
++ poke-cloud-secret
|
||||
|= [secret=cord typ=cord]
|
||||
^- [(list move) _+>.$]
|
||||
?+ typ ~|(missing-platform=typ !!)
|
||||
%do
|
||||
=. client-secret.do.auth.vat
|
||||
[~ secret]
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%+ httpreq /do/auth
|
||||
:^ ~[%digitalocean %cloud] `path`/v1/oauth/token
|
||||
[%post ~]
|
||||
:- ~ `quay`['client_secret'^secret (auth-queries (need authc.do.auth.vat))]
|
||||
==
|
||||
::
|
||||
++ thou-do-auth
|
||||
|= [~ resp=httr]
|
||||
^- [(list move) _+>.$]
|
||||
~| resp
|
||||
=+ body=(rash q:(need r.resp) apex:poja)
|
||||
~| recieve-auth/resp(r body)
|
||||
=+ [ac re]=(need ((ot 'access_token'^so 'refresh_token'^so ~):jo body))
|
||||
=: access.do.toke.vat ac
|
||||
refresh.do.toke.vat re
|
||||
==
|
||||
:_ +>.$
|
||||
:- (publish [%lin & 'successfully authenticated']~)
|
||||
list-do
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: create digital ocean droplets ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ create-do
|
||||
|= act=json
|
||||
=+ ^- deets=create-req-do
|
||||
%- need
|
||||
%. act
|
||||
=> jo
|
||||
%- ot
|
||||
:~ name/so size/so image/so :: id key:img object region/so
|
||||
ssh/(ar so) backups/(mu bo)
|
||||
'ipv6'^(mu bo) 'priv_networking'^(mu bo) 'user_data'^(mu so)
|
||||
==
|
||||
=+ ^- body=json
|
||||
%- create-do-body :*
|
||||
name.deets size.deets image.deets ssh.deets backups.deets ::region.deets
|
||||
ipv6.deets private-networking.deets user-data.deets
|
||||
==
|
||||
%- httpreq :*
|
||||
/create-do
|
||||
~[%digitalocean %api] /v2/droplets
|
||||
[%post body]
|
||||
%^ mo ['Content-Type' 'application/json; charset=utf-8' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~]
|
||||
~
|
||||
~
|
||||
==
|
||||
::
|
||||
++ thou-create-do |=([path resp=httr] ~&(resp :_(+>.$ ~)))
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: create google instances ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ reserve-ip
|
||||
|= name=json
|
||||
=+ nam=(need ((ot name/so ~):jo name))
|
||||
%- httpreq
|
||||
:* /reserve-ip/[nam]
|
||||
~['googleapis' 'www']
|
||||
/compute/v1/projects/urbcloud/regions/us-central1/addresses
|
||||
[%post (joba name/s/nam)]
|
||||
%^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
*quay
|
||||
==
|
||||
::
|
||||
++ thou-reserve-ip
|
||||
|= [pax=path resp=httr]
|
||||
~& resp
|
||||
~| r.resp
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
=+ ur=(need ((ot 'targetLink'^so ~):jo parsed))
|
||||
~& initial-response/parsed
|
||||
=+ name=-:(flop q.q:(need (epur ur)))
|
||||
=+(buf=`@da`(add ~s10 now) :_(+>.$ [ost %wait `path`/check-ip-status/[name] buf]~))
|
||||
::
|
||||
++ wake-check-ip-status
|
||||
|= [name=path ~]
|
||||
~& this-is-the-name/name
|
||||
=+ nam=?~(name !! -.name)
|
||||
:_ +>.$
|
||||
:_ ~
|
||||
%- httpreq
|
||||
:* `path`/check-ip-status/[nam]
|
||||
~['googleapis' 'www']
|
||||
`path`/compute/v1/projects/urbcloud/regions/us-central1/addresses/[nam]
|
||||
%get
|
||||
%^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
*quay
|
||||
==
|
||||
++ thou-check-ip-status
|
||||
|= [name=path resp=httr]
|
||||
~& api-resp/resp
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
!!
|
||||
::?. =('RESERVED' (need ((ot status/so ~):jo parsed)))
|
||||
::
|
||||
|
||||
|
||||
++ create-gce
|
||||
|= jon=json
|
||||
=+ ^- [name=@t image=@t number=@ud]
|
||||
(need ((ot name/so 'instance_img'^so number/ni ~):jo jon))
|
||||
|- ^- (list move)
|
||||
?~ number ~
|
||||
:_ $(number (dec number))
|
||||
=+ nam=(cat 3 name (scot %ud number))
|
||||
=+ ^- body=json
|
||||
%- jobe
|
||||
:~ name/s/nam 'machineType'^s/'zones/us-central1-a/machineTypes/n1-standard-1'
|
||||
:- %disks :- %a :_ ~
|
||||
%- jobe
|
||||
:+ 'initializeParams'^`json`(joba 'sourceImage'^s/image)
|
||||
boot/b/%.y
|
||||
~
|
||||
:- 'networkInterfaces' :- %a :_ ~
|
||||
(joba 'network' `json`[%s 'global/networks/default'])
|
||||
==
|
||||
^- move
|
||||
%- httpreq
|
||||
:* `path`/create-gce
|
||||
`(list cord)`~['googleapis' 'www'] `path`/compute/v1/projects/urbcloud/zones/us-central1-a/'instances'
|
||||
[%post `json`body]
|
||||
%^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~]
|
||||
~
|
||||
`quay`[%key access.gce.toke.vat]~
|
||||
==
|
||||
::
|
||||
++ thou-create-gce |=([path resp=httr] ~&(resp :_(+>.$ ~)))
|
||||
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: perform actions on instances (both kinds) ::
|
||||
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ poke-json :: receive action from client
|
||||
|= jon=json
|
||||
^- [(list move) _+>.$]
|
||||
=+ action=`cloud-command`(need (parse-cloud-command jon))
|
||||
:_ +>.$
|
||||
?- -.action
|
||||
%create-gce [(reserve-ip p.action)]~
|
||||
%create-do [(create-do p.action)]~
|
||||
::%create-gce [(create-gce p.action)]
|
||||
%action [(instance-action [id name act]:action)]~
|
||||
==
|
||||
++ instance-action
|
||||
|= [id=@t name=@t action=droplet-action]
|
||||
=+ d=(~(got by insts.vat) id)
|
||||
~| 'can\'t find id'
|
||||
=+ typ=?~(d !! -.d)
|
||||
?- typ
|
||||
%do
|
||||
=+ ^= meth
|
||||
?: ?=(%delete -.action)
|
||||
%delt
|
||||
[%post (jobe type/s/(convert-do -.action) ?.(?=(%snapshot -.action) ~ [name/s/p.action ~]))]
|
||||
^- move
|
||||
=+ ^= req
|
||||
%- httpreq :*
|
||||
/do/[-.action]
|
||||
~[%digitalocean %api]
|
||||
?:(?=(%delt meth) /v2/droplets/[id] /v2/droplets/[id]/actions)
|
||||
meth
|
||||
%^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~
|
||||
*quay
|
||||
==
|
||||
req
|
||||
::
|
||||
%gce
|
||||
=+ ^= head-query
|
||||
:- %^ mo ['Content-Type' 'application/json' ~]
|
||||
['Authorization' (cat 3 'Bearer ' access.gce.toke.vat) ~] ~
|
||||
*quay
|
||||
?- -.action
|
||||
?(%start %stop %reboot %'snapshot')
|
||||
=+ end=/compute/v1/projects/urbcloud/zones/us-central1-a/instances/[name]
|
||||
%- httpreq
|
||||
:* /gce-act/[-.action] ~['googleapis' 'www']
|
||||
(welp end [?:(?=(%reboot -.action) 'reset' -.action) ~])
|
||||
[%post ~]
|
||||
head-query
|
||||
==
|
||||
::
|
||||
%delete
|
||||
=+ end=/compute/v1/projects/urbcloud/zones/us-central1-a/instances/[name]
|
||||
%- httpreq
|
||||
:* /gce-act/[-.action] ~['googleapis' 'www']
|
||||
end
|
||||
%delt
|
||||
head-query
|
||||
==
|
||||
==
|
||||
==
|
||||
++ thou-do-act
|
||||
|= [pax=path resp=httr]
|
||||
~& [resp act/pax]
|
||||
:_ +>.$ ~
|
||||
::
|
||||
++ thou-gce-act
|
||||
|= [pax=path resp=httr]
|
||||
~& [resp act/pax]
|
||||
:_ +>.$ ~
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: retrieve google instances and images ::
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ list-gce
|
||||
^- (list move)
|
||||
:+ (list-something-gce /zones/['us-central1-a']/instances)
|
||||
(list-something-gce /global/snapshots)
|
||||
~
|
||||
::
|
||||
++ list-something-gce
|
||||
|= endpoint=path
|
||||
=+ ^= lis
|
||||
:*
|
||||
/list-gce/[-.endpoint]
|
||||
~[%googleapis %www] (welp /compute/v1/projects/urbcloud endpoint)
|
||||
%get ~
|
||||
^- quay
|
||||
[%'access_token' access.gce.toke.vat]~
|
||||
==
|
||||
~! lis
|
||||
~! +<:httpreq
|
||||
(httpreq lis)
|
||||
::
|
||||
++ thou-list-gce-zones :: instances
|
||||
|= [pax=path resp=httr]
|
||||
^- [(list move) _+>.$]
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja) :: body httr to json
|
||||
~| 'no list received or bad json'
|
||||
=+ items=(need ((ot items/(ar some) ~):jo parsed))
|
||||
=+ ^- ins=(list ,[@t instance])
|
||||
~| 'bad-json'^items
|
||||
%+ turn items
|
||||
|= in=json
|
||||
=< [id .]
|
||||
^- instance
|
||||
:- %gce
|
||||
%- need
|
||||
%. in =+ jo
|
||||
%- ot
|
||||
:~ name/so id/so status/so 'creationTimestamp'^(su parse-iso8601) ::zone/so
|
||||
'machineType'^(cu tail-url so)
|
||||
:: 'networkInterfaces'^parse-ip-gce
|
||||
==
|
||||
=. insts.vat
|
||||
%- mo
|
||||
%+ weld ins
|
||||
%+ skip (~(tap by insts.vat)) :: keep non-gce
|
||||
|= a=[@t instance] ?=(%gce +<.a)
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
=+ liz=(~(tap by insts.vat))
|
||||
=+ tail=(turn liz |=(a=[@t instance] +.a))
|
||||
:_ +>.$ ::
|
||||
:- [ost %wait /refresh-gce buf]
|
||||
(spam (instance-to-json tail))
|
||||
::
|
||||
++ thou-list-gce-global :: imgs
|
||||
|= [pax=path resp=httr]
|
||||
^- [(list move) _+>.$]
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
=+ imgz=(need ((ot items/(ar some) ~):jo parsed))
|
||||
=. images.vat
|
||||
%- mo
|
||||
%+ weld
|
||||
%+ skip (~(tap by images.vat) *(list ,[[@t @t] image]))
|
||||
|=(a=[[@t @t] image] ?=(%gce ->.a))
|
||||
%+ turn imgz
|
||||
|= a=json
|
||||
=< [[name %gce] .]
|
||||
^- image
|
||||
:- %gce
|
||||
%- need
|
||||
%. a =+ jo
|
||||
%- ot
|
||||
[name/so id/so ~]
|
||||
:_ +>.$ [(spam `json`(image-to-json `(list image)`(map-to-list images.vat)))]
|
||||
::
|
||||
++ wake-refresh-gce |=([path ~] [list-gce +>.$])
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
:: list digital ocean droplets and images ::
|
||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||
++ list-do
|
||||
:+((list-something-do %droplets) (list-something-do %images) ~)
|
||||
++ list-something-do
|
||||
|= som=@tas
|
||||
=+ ^= lis
|
||||
:~ /list-do/[som]
|
||||
~[%digitalocean %api] /v2/[som]
|
||||
%get
|
||||
(mo ['Content-Type' 'application/json' ~] ['Authorization' (cat 3 'Bearer ' access.do.toke.vat) ~] ~)
|
||||
==
|
||||
(httpreq lis)
|
||||
::
|
||||
++ thou-list-do-droplets
|
||||
|= [pax=path resp=httr]
|
||||
^- [(list move) _+>.$]
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja) :: parse httr to json
|
||||
~| recieve-list/parsed
|
||||
=+ dar=(need ((ot droplets/(ar some) ~):jo parsed)) :: reparse ar of insts
|
||||
=+ ^- dropz=(list ,[@t instance])
|
||||
~| bad-json/-.dar
|
||||
%+ turn dar
|
||||
|= drp=json ^- [@t instance]
|
||||
=- ~! - -
|
||||
=< [id .]
|
||||
^- instance
|
||||
:- %do
|
||||
%- need
|
||||
%. drp
|
||||
=+ jo
|
||||
%- ot
|
||||
:~ name/so id/parse-id-text status/so 'created_at'^(su parse-iso8601) ::region/parse-region
|
||||
image/(ot name/so ~) ::disk/ni networks/parse-ip-do
|
||||
==
|
||||
=. insts.vat
|
||||
%- mo
|
||||
%+ weld dropz
|
||||
%+ skip (~(tap by insts.vat) *(list ,[@t instance]))
|
||||
|=(a=[@t instance] ?=(%do +>.$))
|
||||
=+ buf=`@da`(add ~s10 now)
|
||||
:_ +>.$
|
||||
:- [ost %wait /refresh-do buf]
|
||||
%- spam
|
||||
%- instance-to-json
|
||||
%+ turn (~(tap by insts.vat) *(list ,[@t instance]))
|
||||
|=(a=[@t instance] +.a)
|
||||
::
|
||||
++ thou-list-do-images
|
||||
|= [pax=path resp=httr]
|
||||
=+ parsed=(rash q:(need r.resp) apex:poja)
|
||||
~| crashed-do-images/parsed
|
||||
=+ imgz=(need ((ot images/(ar (ot [name/so distribution/so id/no ~])) ~):jo parsed))
|
||||
=+ ^- images=(list ,[[@t @t] image])
|
||||
%+ turn imgz
|
||||
|= [name=@t dist=@t id=@t]
|
||||
=+ nom=(cat 3 name dist)
|
||||
[[%do nom] `image`[%do nom id]]
|
||||
=. images.vat
|
||||
%- mo
|
||||
%+ weld images
|
||||
%+ skip (~(tap by images.vat) *(list ,[[@t @t] image]))
|
||||
|=(a=[[@t @t] image] ?=(%do ->.a))
|
||||
:_ +>.$ ~[(spam `json`(image-to-json `(list image)`(map-to-list images.vat)))]
|
||||
::
|
||||
++ wake-refresh-do |=([path ~] [list-do +>.$])
|
||||
--
|
@ -1,85 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct1/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct1 :: structures
|
||||
/+ sole, oct1 :: libraries
|
||||
[. sole oct1] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axon ,[%0 eye=face gam=game] :: agent state
|
||||
++ card ,[%diff %sole-effect sole-effect] :: update
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ move (pair bone card) :: cause and action
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl :: system state
|
||||
moz=(list move) :: pending actions
|
||||
axon :: server state, v0
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ eels (~(tap by sup)) :: all clients
|
||||
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- ::
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=. ost p.i.all ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ flap |=(con=bike (echo eels con)) :: update all clients
|
||||
++ here ~(. go gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: process logic
|
||||
:: :: ::
|
||||
++ fail (fect %bel ~) :: user error
|
||||
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:kind) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ prom (fect %pro %& %oct1 voy:here) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
|
||||
++ sawn .(eye (~(del by eye) ost)) :: console unsubscribe
|
||||
++ seen .(eye (~(put by eye) ost *sole-share)) :: console subscribe
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ tame (flap |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. show:+<)) :: full update
|
||||
++ word |=(tape (flap |=(_+> (fect:+< txt/+>+<)))) ::
|
||||
:: :: ::
|
||||
:::: :::::: process UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act=sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet %det (delt +.act), %ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) come)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ prep |= (unit (pair (list move) axon)) :: update self
|
||||
abet:?~(+< +> wild(+<+ +<+)) ::
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
--
|
103
ape/oct2.hoon
103
ape/oct2.hoon
@ -1,103 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct2/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct2 :: structures
|
||||
/+ sole, oct2 :: libraries
|
||||
[. sole oct2] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axle ,[eye=face gam=game] :: agent state
|
||||
++ card $% [%diff lime] :: update
|
||||
[%quit ~] :: cancel
|
||||
== ::
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ lime ,[%sole-effect sole-effect] :: :sole update
|
||||
++ move (pair bone card) :: cause and action
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: past state
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ axon $%([%1 axle] [%0 axle-0]) :: all states
|
||||
++ axle-0 ,[eye=face gam=game-0] :: old axle
|
||||
++ game-0 ,[who=? box=board boo=board] :: old game
|
||||
++ wake |= axon :- %1 ?- +<- %1 +<+ :: rough upgrade
|
||||
%0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) come)) :: with wait mode
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl ::
|
||||
moz=(list move) :: pending actions
|
||||
[%1 axle] :: process state, v1
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ flap |=(con=bike (echo (~(tap by sup)) con)) :: update all clients
|
||||
++ here ~(. go src gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: server logic
|
||||
:: :: ::
|
||||
++ fail (fect %bel ~) :: user error
|
||||
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
|
||||
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn (~(tap by sup)) |=(sink q))) ::
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:kind) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ hail |=(? tame(gam (hey:here +<))) :: toggle subscriber
|
||||
++ prom (fect %pro %& %oct2 voy:here) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
|
||||
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
|
||||
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ tame (flap |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. show:+<)) :: full update
|
||||
++ word |=(tape (flap |=(_+> (fect:+< txt/+>+<)))) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act=sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet %det (delt +.act), %ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ prep |= (unit (pair (list move) axon)) :: update self
|
||||
abet:?~(+< +> wild:(heal +<+>)) ::
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
--
|
116
ape/oct3.hoon
116
ape/oct3.hoon
@ -1,116 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct3/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct3 :: structures
|
||||
/+ sole, oct3 :: libraries
|
||||
[. sole oct3] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axle ,[eye=face gam=game] :: agent state
|
||||
++ card $% [%diff lime] :: update
|
||||
[%quit ~] :: cancel
|
||||
== ::
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ lime $% [%sole-effect sole-effect] :: :sole update
|
||||
[%oct3-update play] :: :oct3 update
|
||||
== ::
|
||||
++ move (pair bone card) :: cause and action
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: past state
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ axon $%([%1 axle] [%0 axle-0]) :: all states
|
||||
++ axle-0 ,[eye=face gam=game-0] :: old axle
|
||||
++ game-0 ,[who=? box=board boo=board] :: old game
|
||||
++ wake |= axon :- %1 ?- +<- %1 +<+ :: coarse upgrade
|
||||
%0 [eye [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) come)) :: with wait mode
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl ::
|
||||
moz=(list move) :: pending actions
|
||||
[%1 axle] :: process state, v1
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ eels (~(tap by sup)) :: all clients
|
||||
++ elfs (prey /oct3 +<-) :: network clients
|
||||
++ elks (prey /sole +<-) :: console clients
|
||||
++ flap |= [net=bike con=bike] :: update all clients
|
||||
(echo:(echo elks con) elfs net) ::
|
||||
++ here ~(. go src gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: server logic
|
||||
:: :: ::
|
||||
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
|
||||
++ fect |=(sole-effect (dish %diff %sole-effect +<)) :: update console
|
||||
++ fact |=(play (dish %diff %oct3-update +<)) :: update partner
|
||||
++ hail |=(? tame(gam (hey:here +<))) :: toggle subscriber
|
||||
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn eels |=(sink q))) ::
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:kind) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ prom (fect %pro %& %oct3 voy:here) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
|
||||
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
|
||||
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ soul =+((~(get by sup) ost) ?=([~ * %sole *] -)) :: is console
|
||||
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
|
||||
++ word |= txt=tape %+ flap :: game message
|
||||
|=(_+> (fact:+< |/txt)) ::
|
||||
|=(_+> (fect:+< txt/txt)) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act=sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet %det (delt +.act), %ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt come)) :: apply command line
|
||||
?~(- fail ?~(-> show (kick:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ peer-oct3 |=(* abet:tame:(hail &)) :: urbit subscribe
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ poke-oct3-move |=(point abet:wild:(kick +<)) :: urbit move
|
||||
++ prep |= (unit (pair (list move) axon)) :: update self
|
||||
abet:?~(+< +> wild:(heal +<+>)) ::
|
||||
++ pull-oct3 |=(* abet:(hail |)) :: urbit unsubscribe
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
--
|
139
ape/oct4.hoon
139
ape/oct4.hoon
@ -1,139 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct4/ape :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- sole, oct4 :: structures
|
||||
/+ sole, oct4 :: libraries
|
||||
[. sole oct4] :: ::
|
||||
:: :: ::
|
||||
:::: :::::: interfaces
|
||||
!: :: ::
|
||||
=> |% ::
|
||||
++ axle ,[eye=face rem=(unit ship) gam=game] :: agent state
|
||||
++ card $% [%diff lime] :: update
|
||||
[%quit ~] :: cancel
|
||||
[%peer wire dock path] :: subscribe
|
||||
[%poke wire dock pear] :: send move
|
||||
[%pull wire dock ~] :: unsubscribe
|
||||
== ::
|
||||
++ face (map bone sole-share) :: console state
|
||||
++ lime $% [%sole-effect sole-effect] :: :sole update
|
||||
[%oct4-update play] :: :oct4 update
|
||||
== ::
|
||||
++ move (pair bone card) :: cause and action
|
||||
++ pear ,[%oct4-move point] :: outgoing move
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: past state
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ agon (unit ,[(list move) axon]) :: boot argument
|
||||
++ axon $%([%1 axle] [%0 axle-0]) :: all states
|
||||
++ axle-0 ,[eye=face gam=game-0] :: old axle
|
||||
++ game-0 ,[who=? box=board boo=board] :: old game
|
||||
++ wake |= axon :- %1 ?- +<- %1 +<+ :: coarse upgrade
|
||||
%0 [eye ~ [who ~^~ ~ box boo]:gam]:+<+ ::
|
||||
== -- ::
|
||||
:: :: ::
|
||||
:::: :::::: parsers
|
||||
:: :: ::
|
||||
=> |% ::
|
||||
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
|
||||
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
|
||||
++ comb (pick come ;~(pfix sig (punt fed:ag))) :: all command input
|
||||
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: process core
|
||||
:: :: ::
|
||||
|_ $: bowl ::
|
||||
moz=(list move) :: pending actions
|
||||
[%1 axle] :: process state, v1
|
||||
== ::
|
||||
:: :: ::
|
||||
:::: :::::: process tools
|
||||
:: :: ::
|
||||
++ abet [(flop moz) .(moz ~)] :: resolve
|
||||
++ bike $+(_. _+>) :: self-transformer
|
||||
++ dish |=(cad=card %_(+> moz [[ost cad] moz])) :: request
|
||||
++ done (echo eels |=(_. (dish:+< %quit ~))) :: cancel everyone
|
||||
++ echo |= [all=(list sink) fun=bike] =+ old=+>+<- :: publish to all
|
||||
|- ^+ +>.^$ ?~ all +>.^$(+<- old) ::
|
||||
=> .(ost p.i.all, src q.i.all) ::
|
||||
$(all t.all, +>.^$ (fun +>.^$)) ::
|
||||
++ eels (~(tap by sup)) :: all clients
|
||||
++ elfs (prey /oct4 +<-) :: network clients
|
||||
++ elks (prey /sole +<-) :: console clients
|
||||
++ emit |=(lime (dish %diff +<)) :: publish
|
||||
++ flap |= [net=bike con=bike] :: update all clients
|
||||
(echo:(echo elks con) elfs net) ::
|
||||
++ here ~(. go src gam) :: game core
|
||||
:: :: ::
|
||||
:::: :::::: server logic
|
||||
:: :: ::
|
||||
++ fail ?:(soul (fect %bel ~) ~|(%invalid-move !!)) :: user error
|
||||
++ fect |=(sole-effect (emit %sole-effect +<)) :: update console
|
||||
++ fact |=(play (emit %oct4-update +<)) :: update partner
|
||||
++ hail |=(? ?^(rem +> tame(gam (hey:here +<)))) :: toggle subscriber
|
||||
++ harp |=(game ?:(=(gam +<) +> wild(gam +<))) :: update game
|
||||
++ heal |= old=axon =. +>+<+> (wake old) :: complete update
|
||||
=- +>.$(gam -) ?. !=(1 +<-) gam ::
|
||||
(muy:here (turn eels |=(sink q))) ::
|
||||
++ hear |=(play ?-(+<- | (word +<+), & (harp +<+))) :: network update
|
||||
++ kick |= point =^ dud gam ~(m at:here +<) ::
|
||||
?.(dud fail wild:?~(rem kind (send +>-))) ::
|
||||
++ kind =+(res:here ?~(- + (word(gam new:here) ->))) :: move result
|
||||
++ plan |= (unit ship) ?~ +< stop(gam new:here) :: link/unlink
|
||||
?^(rem fail link(rem +<)) ::
|
||||
++ plot |= (each point (unit ship)) :: apply command
|
||||
?-(+<- & (kick +<+), | (plan +<+)) ::
|
||||
++ like |*(* [/oct4 [+.rem dap] +<]) :: friend message
|
||||
++ link (dish peer/(like /oct4)) :: subscribe to friend
|
||||
++ prom (fect %pro %& %oct4 stat) :: update prompt
|
||||
++ rend (turn `wall`tab:here |=(tape txt/+<)) :: table print
|
||||
++ sawn (hail(eye (~(del by eye) ost)) |) :: console unsubscribe
|
||||
++ seen (hail(eye (~(put by eye) ost *sole-share)) &) :: console subscribe
|
||||
++ send |=(point (dish poke/(like %oct4-move +<))) :: send move
|
||||
++ show prom:(fect %mor rend) :: update console
|
||||
++ soul =+((~(get by sup) ost) ?=([~ * %sole *] -)) :: is console
|
||||
++ stat (weld ?~(rem ~ "@{(scow p/u.rem)}") voy:here) :: prompt line
|
||||
++ stop ?~(rem done wild:(dish pull/(like ~))) :: unsubscribe
|
||||
++ tame (flap |=(_. (fact:+< &/gam)) |=(_. prom:+<)) :: light update
|
||||
++ wild (flap |=(_. (fact:+< &/gam)) |=(_. show:+<)) :: full update
|
||||
++ with |=(? (word(rem ?:(+< rem ~)) "{<[+< src]>}")) ::
|
||||
++ word |= txt=tape %+ flap :: game message
|
||||
|=(_+> (fact:+< |/txt)) ::
|
||||
|=(_+> (fect:+< txt/txt)) ::
|
||||
:: :: ::
|
||||
:::: :::::: console UI
|
||||
:: :: ::
|
||||
++ work :: console action
|
||||
|= act=sole-action ::
|
||||
=+ say=(~(got by eye) ost) ::
|
||||
|^ ?+(-.act abet %det (delt +.act), %ret dive) ::
|
||||
++ abet ..work(eye (~(put by eye) ost say)) :: resolve
|
||||
++ cusp (cope !ept:here) :: parsing rule
|
||||
++ delt |= cal=sole-change :: edit command line
|
||||
=^ cul say (~(remit sole say) cal good) ::
|
||||
?~(cul abet fail:(fect:abet det/u.cul)) ::
|
||||
++ dive =+ (rust (tufa buf.say) (punt comb)) :: apply command line
|
||||
?~(- fail ?~(-> show (plot:wipe ->+))) ::
|
||||
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: validate input
|
||||
++ wipe =^ cal say (~(transmit sole say) set/~) :: clear line
|
||||
(fect:abet %det cal) ::
|
||||
-- ::
|
||||
:: :: ::
|
||||
:::: :::::: arvo handlers
|
||||
:: :: ::
|
||||
++ reap-oct4 |=([* (unit)] abet:(with =(~ +<+))) :: linked to friend
|
||||
++ coup-oct4 |=([* (unit)] abet:?~(+<+ +> fail)) :: move acknowledge
|
||||
++ diff-oct4-update |=([* play] abet:(hear +<+)) :: network update
|
||||
++ peer-oct4 |=(* abet:tame:(hail &)) :: urbit subscribe
|
||||
++ peer-sole |=(* abet:show:seen) :: console subscribe
|
||||
++ poke-sole-action |=(sole-action abet:(work +<)) :: console input
|
||||
++ poke-oct4-move |=(point abet:wild:(kick +<)) :: urbit move
|
||||
++ prep |=(agon abet:?~(+< +> (heal +<+>))) :: load state
|
||||
++ pull-oct4 |=(* abet:(hail |)) :: urbit unsubscribe
|
||||
++ pull-sole |=(* abet:sawn) :: console unsubscribe
|
||||
++ quit-oct4 |=(* abet:?~(rem +> wild(rem ~))) :: unlinked by friend
|
||||
--
|
@ -1,8 +0,0 @@
|
||||
/- twitter
|
||||
!:
|
||||
[twitter .]
|
||||
|_ [bowl ~]
|
||||
++ poke-noun |=(span (onwards [%peer / [our %twit] /user/[+<]]))
|
||||
++ onwards |*([mark *] [[ost +<]~ +>.$])
|
||||
++ diff-twit-feed |=([* a=(list twit-stat)] ?~(a `+>.$ ~&(i.a $(a t.a))))
|
||||
--
|
219
ape/twit.hoon
219
ape/twit.hoon
@ -1,219 +0,0 @@
|
||||
:: Twitter daemon
|
||||
::
|
||||
:::: /hook/core/twit/app
|
||||
::
|
||||
/- twitter
|
||||
/+ twitter, talk
|
||||
::
|
||||
:::: ~fyr
|
||||
::
|
||||
[twitter .]
|
||||
|%
|
||||
++ twit-path :: valid peer path
|
||||
$% :: [%home ~] :: home timeline
|
||||
[%user p=@t ~] :: user's tweets
|
||||
[%post p=span:,@uv ~] :: status of status
|
||||
==
|
||||
::
|
||||
++ axle :: app state
|
||||
$: %0
|
||||
kes=(map span keys:twit-do) :: auth
|
||||
out=(map ,@uvI (each ,[span cord] stat)) :: sent tweets
|
||||
ran=(map path ,[p=@ud q=@da]) :: polls active
|
||||
fed=(jar path stat) :: feed cache
|
||||
==
|
||||
::
|
||||
++ gift :: subscription action
|
||||
$% [%quit ~] :: terminate
|
||||
[%diff gilt] :: send data
|
||||
==
|
||||
++ gilt
|
||||
$% [%twit-feed p=(list stat)] :: posts in feed
|
||||
[%twit-stat p=stat] :: tweet accepted
|
||||
[%ares term (list tank)]
|
||||
==
|
||||
::
|
||||
++ move ,[bone card]
|
||||
++ card :: arvo request
|
||||
$? gift
|
||||
$% [%them path ~ u=hiss] :: HTTP request
|
||||
[%poke wire dock %talk-command command:talk] ::
|
||||
[%wait path p=@da] :: timeout
|
||||
== ==
|
||||
::
|
||||
++ sign :: arvo response
|
||||
$% [%e %thou p=httr] :: HTTP result
|
||||
[%t %wake ~] :: timeout ping
|
||||
==
|
||||
::
|
||||
++ stat twit-stat :: recieved tweet
|
||||
--
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|_ [bowl axle]
|
||||
++ any-auth ?~(kes (auth) (auth p.n.kes)) :: use any keys
|
||||
++ auth :: build API door
|
||||
|= a=span
|
||||
~| [%no-auth a]
|
||||
~(. twit (~(got by kes) a) now `@`eny)
|
||||
::
|
||||
++ cull :: remove seen tweets
|
||||
|= [pax=path rep=(list stat)] ^+ rep
|
||||
=+ pev=(sa (turn (~(get ja fed) pax) |=(stat id)))
|
||||
(skip rep |=(stat (~(has in pev) id)))
|
||||
::
|
||||
++ done [*(list move) .]
|
||||
++ dely :: next polling timeout
|
||||
|= pax=path
|
||||
^- [(unit time) _ran]
|
||||
=+ cur=(~(get by ran) pax)
|
||||
=+ tym=(add now (mul ~s8 (bex ?~(cur 0 p.u.cur))))
|
||||
:: ~& dely/`@dr`(sub tym now)
|
||||
?: &(?=(^ cur) (gte tym q.u.cur) (gth q.u.cur now))
|
||||
[~ ran]
|
||||
[`tym (~(put by ran) pax ?~(cur 0 (min 5 +(p.u.cur))) tym)]
|
||||
::
|
||||
++ wait :: ensure poll by path
|
||||
|= [pax=path mof=(list move)]
|
||||
=^ tym ran (dely pax)
|
||||
:_ +>.$
|
||||
?~ tym
|
||||
:: ~& no-wait/ran
|
||||
mof
|
||||
:: ~& will-wait/u.tym
|
||||
:- [ost %wait pax u.tym]
|
||||
mof
|
||||
::
|
||||
++ poke-twit-do :: recieve request
|
||||
|= act=twit-do
|
||||
^+ [*(list move) +>]
|
||||
?- -.q.act
|
||||
%auth
|
||||
:- [(print "authed @{(trip p.act)}")]~
|
||||
+>.$(kes (~(put by kes) p.act p.q.act)) :: XX verify key
|
||||
%post
|
||||
=: out (~(put by out) p.q.act %& p.act q.q.act)
|
||||
ran (~(del by ran) /peer/home)
|
||||
==
|
||||
%+ wait /peer/home
|
||||
=+ mez=(stat-upda:(auth p.act) [%status q.q.act]~ ~)
|
||||
[ost %them /post/(scot %uv p.q.act) ~ mez]~
|
||||
==
|
||||
::
|
||||
++ wake-peer
|
||||
|= [pax=path ~] ^+ done
|
||||
~& twit-wake/peer/pax
|
||||
:_ +>.$
|
||||
?. (~(has by ran) peer/pax) :: ignore if retracted
|
||||
~
|
||||
=+ => |=([a=bone @ b=path] [b a])
|
||||
pus=(~(gas ju *(jug path bone)) (turn (~(tap by sup)) .))
|
||||
?~ (~(get ju pus) pax)
|
||||
~
|
||||
~& peer-again/[pax ran]
|
||||
(pear | our pax)
|
||||
::
|
||||
++ thou
|
||||
|= [pax=path hit=httr] ^+ done
|
||||
?+ p.hit ~|([%unknown-code p.hit] !!)
|
||||
429 :: Rate-limit
|
||||
=. ran (~(put by ran) pax 6 now)
|
||||
=+ lim=%.(%x-rate-limit-reset ;~(biff ~(get by (mo q.hit)) poja ni:jo))
|
||||
=+ tym=?~(lim (add ~m7.s30 now) (add ~1970.1.1 (mul ~s1 u.lim)))
|
||||
~& retrying-in/`@dr`(sub tym now)
|
||||
:_(+>.$ [ost %wait pax tym]~)
|
||||
::
|
||||
200 :: OK
|
||||
=+ jon=(need (poja q:(need r.hit)))
|
||||
:: ~& twit-resp/%.(jon ?+(-.jon !! %o stat:twir, %a (ar:jo stat:twir)))
|
||||
?+ pax ~|([%http-missed pax] !!)
|
||||
[%post @ ~] :: post acknowledged
|
||||
=+ ^= rep
|
||||
~| [%bad-post jon]
|
||||
(need %.(jon stat:twir))
|
||||
=. out (~(put by out) (slav %uv i.t.pax) %| rep)
|
||||
:_ +>.$
|
||||
=+ pax=/[who.rep]/status/(rsh 3 2 (scot %ui id.rep))
|
||||
:- (print (earn [& ~ `/com/twitter] `pax ~))
|
||||
(spam pax (tweet-good rep))
|
||||
[%peer *] :: feed data
|
||||
=+ ^= rep
|
||||
~| [%bad-feed jon]
|
||||
(need %.(jon (ar:jo stat:twir)))
|
||||
:: ~& got-feed/[(scag 5 (turn rep |=(stat id))) fed]
|
||||
=+ ren=(cull t.pax rep) :: new messages
|
||||
?~ ren
|
||||
(wait pax ~) :: pump polling
|
||||
:: ~& spam-feed/ren
|
||||
=: ran (~(del by ran) pax) :: clear poll delay
|
||||
fed (~(put by fed) t.pax rep) :: saw last message
|
||||
==
|
||||
(wait pax (spam t.pax [%diff twit-feed/(flop ren)] ~))
|
||||
==
|
||||
::
|
||||
?(400 401 403 404) :: Err
|
||||
=+ ^- git=gift
|
||||
=+ err=%.(q:(need r.hit) ;~(biff poja mean:twir))
|
||||
:^ %diff %ares %bad-http
|
||||
[leaf/"HTTP Code {<p.hit>}" (turn (need err) mean:twip)]
|
||||
?+ pax [[ost git]~ +>.$]
|
||||
[%post @ ~]
|
||||
[(spam pax git ~) +>.$]
|
||||
==
|
||||
==
|
||||
++ tweet-good |=(rep=stat `(list gift)`~[[%diff %twit-stat rep] [%quit ~]])
|
||||
++ peer |=(pax=path :_(+> (pear & src pax))) :: accept subscription
|
||||
++ pear :: poll, possibly returning current data
|
||||
|= [ver=? @ pax=path]
|
||||
^- (list move)
|
||||
?. ?=(twit-path pax)
|
||||
~|([%missed-path pax] !!)
|
||||
=> .(pax `twit-path`pax)
|
||||
?: ?=(%post -.pax)
|
||||
?. ver ~
|
||||
=+ sta=(~(get by out) (slav %uv p.pax))
|
||||
?. ?=([~ %| ^] sta) :: post not received
|
||||
~
|
||||
~[[ost %diff %twit-stat p.u.sta] [ost %quit ~]]
|
||||
=+ ole=(~(get ja fed) pax)
|
||||
:_ ^- (list move)
|
||||
?. ver ~
|
||||
?~ ole ~
|
||||
[ost %diff %twit-feed (flop ole)]~
|
||||
=- `move`[ost %them peer/pax ~ `hiss`-]
|
||||
=+ opt=?~(ole ~ ['since_id' (lutt:twit id.i.ole)]~)
|
||||
=+ aut=any-auth
|
||||
?- -.pax
|
||||
%user (stat-user:aut [(to-sd p.pax)]~ opt)
|
||||
:: %home (stat-home:auth ~ opt)
|
||||
==
|
||||
::
|
||||
++ to-sd :: parse user name/numb
|
||||
|= a=span ^- sd:twit
|
||||
~| [%not-user a]
|
||||
%+ rash a
|
||||
;~(pose (stag %user-id dem) (stag %screen-name user:twir))
|
||||
::
|
||||
:: ++ pull :: release subscription
|
||||
:: |= ost=bone
|
||||
:: ?. (~(has by sup) ost) `+>.$ :: XX should not occur
|
||||
:: =+ [his pax]=(~(got by sup) ost)
|
||||
:: ?: (lth 1 ~(wyt in (~(get ju pus) pax)))
|
||||
:: `+>.$
|
||||
:: =: ran (~(del by ran) [%peer pax])
|
||||
:: fed (~(del by fed) pax)
|
||||
:: ==
|
||||
:: `+>.$
|
||||
::
|
||||
++ spam :: send by path
|
||||
|= [a=path b=(list gift)] ^- (list move)
|
||||
%- zing ^- (list (list move))
|
||||
%+ turn (~(tap by sup))
|
||||
|= [ost=bone @ pax=path]
|
||||
?. =(pax a) ~
|
||||
(turn b |=(c=gift [ost c]))
|
||||
::
|
||||
++ print
|
||||
|=(mes=tape [ost %poke / [our %talk] (said our %twit now eny leaf/mes ~)])
|
||||
--
|
@ -1,14 +0,0 @@
|
||||
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ arg=[address=@t contact=@t ~] ~]
|
||||
:- %address-contact
|
||||
[address.arg contact.arg]
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ [arg1=cord arg2=cord ~] ~] ::[arg=[cord cord ~] ~]]
|
||||
:- %auth
|
||||
[arg1 arg2]
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ [amount=@t currency=@t ~] ~]
|
||||
:- %buy
|
||||
[amount currency]
|
@ -1,14 +0,0 @@
|
||||
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ arg=[contact=@t address=@t ~] ~]
|
||||
:- %bit-contact
|
||||
[contact.arg address.arg]
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ ~ ~]
|
||||
:- %list
|
||||
~
|
||||
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ [amount=@t currency=@t ~] ~]
|
||||
:- %sell
|
||||
[amount currency]
|
||||
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
:::::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ [to=@uc amo=@t ~] ~]
|
||||
[%bit-send to amo]
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 310
|
||||
::
|
||||
::::
|
||||
!:
|
||||
:- %say
|
||||
|= [^ [arg=(list cord) ~]]
|
||||
:- %keys
|
||||
arg
|
@ -1,10 +0,0 @@
|
||||
/- twitter
|
||||
::
|
||||
::::
|
||||
::
|
||||
[twitter .]
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvI bec=beak]
|
||||
[[who=span msg=cord ~] ~]
|
||||
==
|
||||
[%twit-do [who %post eny msg]]
|
@ -1,23 +0,0 @@
|
||||
:: Input twitter keys
|
||||
/- sole, twitter
|
||||
!:
|
||||
[sole twitter .]
|
||||
|%
|
||||
++ baz64 (cook crip (star alp))
|
||||
--
|
||||
!:
|
||||
:- %ask
|
||||
|= $: [now=@da eny=@uvI bec=beak]
|
||||
[~ ~]
|
||||
==
|
||||
^- (sole-result (cask twit-do))
|
||||
%+ sole-lo [%& %$ "User: "] %+ sole-go urs:ab |= acc=span
|
||||
%+ sole-lo [%& %$ "App token: "] %+ sole-go baz64 |= ctok=cord
|
||||
%+ sole-lo [%& %$ "App secret: "] %+ sole-go baz64 |= csec=cord
|
||||
%+ sole-lo [%& %$ "User token: "] %+ sole-go baz64 |= atok=cord
|
||||
%+ sole-lo [%& %$ "User secret: "] %+ sole-go baz64 |= asec=cord
|
||||
(sole-so %twit-do [acc %auth [ctok csec] atok asec])
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
hoontap
|
||||
AP3G1t8ki6rPzeeAqdWCTw03F
|
||||
VV784LPwZSaAxtF16RWWTnST4F85BHN8VqQKNyv7MprCkA0xZD
|
||||
2821727326-RZGXSeTn7hCFQfJqR0ViivM3YYpu2O1M71gelBl
|
||||
jW9VygFPOTsEK0WmrJDHYSoEnofOPdCE1oQRzueemVTl8
|
@ -1,13 +0,0 @@
|
||||
/+ sh-utils
|
||||
!:
|
||||
|_ [hide ~]
|
||||
++ peer ,_`.
|
||||
++ poke--args
|
||||
%+ add-subs [[our /twit] our /post/(scot %uv eny)]
|
||||
%^ gate-mess .
|
||||
|=([a=span b=cord ~] [/twit %twit-do !>([a %post eny b])])
|
||||
,_`.
|
||||
++ posh-twit-stat
|
||||
(args-into-gate . |=([@ @ a=@da @] tang/~[leaf/"Tweet recieved {<a>}"]))
|
||||
++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
|
||||
--
|
@ -1,23 +0,0 @@
|
||||
:: Display twitter feed
|
||||
::
|
||||
:::: /hook/core/twitter-feed/app
|
||||
::
|
||||
/+ sh-utils
|
||||
!:
|
||||
::
|
||||
:::: ~fyr
|
||||
::
|
||||
|_ [hide ~]
|
||||
++ stat ,[id=@u who=@ta now=@da txt=@t]
|
||||
++ rens
|
||||
:- %say
|
||||
|=(stat rose/[": " `~]^~[leaf/"{<now>} @{(trip who)}" leaf/(trip txt)])
|
||||
++ peer ,_`.
|
||||
++ poke--args
|
||||
|= [ost=bone his=ship who=span ~]
|
||||
%.(+< (add-subs [[our /twit] our /user/[who]] ,_`+>.$))
|
||||
::
|
||||
++ posh-twit-feed
|
||||
(args-into-gate . |=(a=(list stat) tang/(turn a rens)))
|
||||
:: ++ pour |*([ost=@ * sih=[@ ^]] :_(+>.$ [ost %give +.sih]~))
|
||||
--
|
@ -1,43 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct1/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct1 :: structures
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
[oct1 .]
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud=board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ game ::
|
||||
++ at |_ point :: per point
|
||||
++ g +>+< :: game
|
||||
++ k !|(x o) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<)) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<)) :: play at x
|
||||
-- ::
|
||||
++ new +<(boo 0, box 0, who &) :: reset game
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<~[(icon who)]>} wins" ::
|
||||
++ row |= y=@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ voy ": {<~[(icon who)]>} (row/col): " :: print prompt
|
||||
--
|
||||
--
|
@ -1,59 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct2/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct2 :: structures
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
[oct2 .]
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud=board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ [src=ship game] ::
|
||||
++ at |_ point :: per point
|
||||
++ g `game`+>+<+ :: game
|
||||
++ k &(!|(x o) ept) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
|
||||
-- ::
|
||||
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
|
||||
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter/leave
|
||||
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
|
||||
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
|
||||
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
|
||||
?: =(q.sag `src) ['=' (icon |) ~] ::
|
||||
"" (welp (scow %p src) `tape`-) ::
|
||||
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
|
||||
++ oth own(who !who) :: who owns other turn
|
||||
++ own ?:(who p.sag q.sag) :: who owns this turn
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<nam>} wins" ::
|
||||
++ row |= y=@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ str =+ [own ~[(icon who)]] ^- tape :: print player
|
||||
?~(-< -> (scow %p u.-<)) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
|
||||
=+ dow=(~(tap by aud)) |- ^- tape ::
|
||||
?~ dow ~ =+ mor=$(dow t.dow) ::
|
||||
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
|
||||
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
|
||||
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
|
||||
--
|
||||
--
|
@ -1,60 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct3/lib :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct3 :: structures
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
!: :: ::
|
||||
[. ^oct3]
|
||||
|% ::
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud=board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ jon a/(turn (gulf 0 9) |=(@ b/(bit +<))) :: to json
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ [src=ship game] ::
|
||||
++ at |_ point :: per point
|
||||
++ g `game`+>+<+ :: game
|
||||
++ k &(!|(x o) ept) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
|
||||
-- ::
|
||||
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
|
||||
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter/leave
|
||||
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
|
||||
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
|
||||
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
|
||||
?: =(q.sag `src) ['=' (icon |) ~] ::
|
||||
"" (welp (scow %p src) `tape`-) ::
|
||||
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
|
||||
++ oth own(who !who) :: who owns other turn
|
||||
++ own ?:(who p.sag q.sag) :: who owns this turn
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<nam>} wins" ::
|
||||
++ row |= y=@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ str =+ [own ~[(icon who)]] ^- tape :: print player
|
||||
?~(-< -> (scow %p u.-<)) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
|
||||
=+ dow=(~(tap by aud)) |- ^- tape ::
|
||||
?~ dow ~ =+ mor=$(dow t.dow) ::
|
||||
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
|
||||
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
|
||||
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
|
||||
--
|
||||
--
|
@ -1,60 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct4/lib :: :: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
/- oct4 :: structures
|
||||
:: :: ::
|
||||
:::: :: :: semantics
|
||||
!: :: ::
|
||||
[. ^oct4]
|
||||
|%
|
||||
++ icon |=(? ?:(+< 'X' 'O')) :: display at
|
||||
++ bo :: per board
|
||||
|_ bud=board ::
|
||||
++ bit |=(@ =(1 (cut 0 [+< 1] bud))) :: moved at address
|
||||
++ get |=(point (bit (off +<))) :: get point
|
||||
++ jon a/(turn (gulf 0 9) |=(@ b/(bit +<))) :: to json
|
||||
++ off |=(point (add x (mul 3 y))) :: bitfield address
|
||||
++ set |=(point (con bud (bex (off +<)))) :: set point
|
||||
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
|
||||
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
|
||||
-- ::
|
||||
++ go :: play from
|
||||
|_ [src=ship game] ::
|
||||
++ at |_ point :: per point
|
||||
++ g `game`+>+<+ :: game
|
||||
++ k &(!|(x o) ept) :: legal move
|
||||
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
|
||||
++ o (~(get bo boo) +<) :: old at o
|
||||
++ p .(boo (~(set bo boo) +<), q.sag `src) :: play at o
|
||||
++ t .(who !who) :: take turn
|
||||
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
|
||||
++ x (~(get bo box) +<) :: old at x
|
||||
++ y .(box (~(set bo box) +<), p.sag `src) :: play at x
|
||||
-- ::
|
||||
++ ept =+(own |(&(=(~ -) !=(oth `src)) =(`src -))) :: we can play
|
||||
++ hey |=(? +>+<+(aud ((stat ship) +< src aud))) :: enter/leave
|
||||
++ muy |= (list ship) ?~ +< +>+<+ :: many in audience
|
||||
$(+< t.+<, aud ((stat ship) & i.+< aud)) ::
|
||||
++ nam =+ ?: =(p.sag `src) ['=' (icon &) ~] :: print name
|
||||
?: =(q.sag `src) ['=' (icon |) ~] ::
|
||||
"" (welp (scow %p src) `tape`-) ::
|
||||
++ new +<+(boo 0, box 0, who &, sag [~ ~]) :: reset game
|
||||
++ oth own(who !who) :: who owns other turn
|
||||
++ own ?:(who p.sag q.sag) :: who owns this turn
|
||||
++ res ?. |(~(win bo box) ~(win bo boo)) :: possible result
|
||||
?: =(511 (con boo box)) ::
|
||||
`"tie :-(" ~ `"{<nam>} wins" ::
|
||||
++ row |= y=@ :- (add y '1') %- zing :: print row
|
||||
(turn (gulf 0 3) |=(@ ~[' ' ~(v at y +<)])) ::
|
||||
++ str =+ [own ~[(icon who)]] ^- tape :: print player
|
||||
?~(-< -> (scow %p u.-<)) ::
|
||||
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
|
||||
++ vew =- ?: =(~ -) ~ :(weld "[" - "]") :: print watchers
|
||||
=+ dow=(~(tap by aud)) |- ^- tape ::
|
||||
?~ dow ~ =+ mor=$(dow t.dow) ::
|
||||
:(weld nam(src p.i.dow) ?~(mor "" ", ") mor) ::
|
||||
++ voy =+ ~[(icon who)] %+ weld vew :: print prompt
|
||||
?.(ept " ({-}'s turn) " ": {-} (row/col): ")::
|
||||
--
|
||||
--
|
544
lib/twitter.hoon
544
lib/twitter.hoon
@ -1,544 +0,0 @@
|
||||
:: A Twitter API library.
|
||||
::
|
||||
:::: /hoon/twitter/lib
|
||||
::
|
||||
/? 314
|
||||
/- twitter
|
||||
=+ twit:twitter
|
||||
!:
|
||||
:::: functions
|
||||
::
|
||||
|%
|
||||
++ fass :: rewrite path
|
||||
|= a=path
|
||||
%- trip
|
||||
%^ gsub '-' '_'
|
||||
%+ reel a
|
||||
|= [p=@t q=@t]
|
||||
(cat 3 '/' (cat 3 p q))
|
||||
::
|
||||
++ gsub :: replace chars
|
||||
|= [a=@t b=@t t=@t]
|
||||
^- @t
|
||||
?~ t t
|
||||
%+ add (lsh 3 1 $(t (rsh 3 1 t)))
|
||||
=+ c=(mod t (bex 8))
|
||||
?:(=(a c) b c)
|
||||
::
|
||||
++ oauth :: OAuth 1.0 header
|
||||
|= $: med=meth
|
||||
url=tape
|
||||
pas=(list tape)
|
||||
key=keys
|
||||
zet=@
|
||||
ken=@
|
||||
==
|
||||
^- @t
|
||||
=+ non=(turn (rip 2 (shaw zet 128 ken)) |=(a=@ ~(x ne a)))
|
||||
=+ tim=(slag 2 (scow %ui (unt zet)))
|
||||
=+ sky=(crip :(weld (urle (trip sec.con.key)) "&" (urle (trip sec.acc.key))))
|
||||
=+ ^= bas
|
||||
^- tape
|
||||
=+ ^= hds
|
||||
%- reel :_ |=([p=tape q=tape] :(weld p "&" q))
|
||||
%- sort :_ aor
|
||||
%- weld :- pas
|
||||
^- (list tape)
|
||||
:~ :(weld "oauth_consumer_key=" (trip tok.con.key))
|
||||
:(weld "oauth_nonce=" non)
|
||||
:(weld "oauth_signature_method=HMAC-SHA1")
|
||||
:(weld "oauth_timestamp=" tim)
|
||||
:(weld "oauth_token=" (trip tok.acc.key))
|
||||
:(weld "oauth_version=1.0")
|
||||
==
|
||||
;: weld
|
||||
(trip (cuss (trip `@t`med))) "&"
|
||||
(urle url) "&"
|
||||
(urle (scag (dec (lent hds)) `tape`hds))
|
||||
==
|
||||
=+ sig=`tape`(sifo (swap 3 (hmac (swap 3 sky) (crip bas))))
|
||||
%- crip
|
||||
;: weld "OAuth "
|
||||
"oauth_consumer_key=" "\"" (trip tok.con.key) "\", "
|
||||
"oauth_nonce=" "\"" non "\", "
|
||||
"oauth_signature=" "\"" (urle sig) "\", "
|
||||
"oauth_signature_method=\"HMAC-SHA1\", "
|
||||
"oauth_timestamp=" "\"" tim "\", "
|
||||
"oauth_token=" "\"" (trip tok.acc.key) "\", "
|
||||
"oauth_version=1.0"
|
||||
==
|
||||
::
|
||||
++ valve :: produce request
|
||||
|= $: med=meth
|
||||
[rus=tape quy=quay]
|
||||
key=keys
|
||||
est=time
|
||||
eny=@
|
||||
==
|
||||
^- hiss
|
||||
=+ url="https://api.twitter.com/1.1{rus}.json"
|
||||
=+ req=|=(a=tape (scan a auri:epur))
|
||||
=+ ^= help
|
||||
|= quy=(list ,[tape tape])
|
||||
^- (list tape)
|
||||
%+ turn quy
|
||||
|= a=[p=tape q=tape]
|
||||
:(weld (urle p.a) "=" (urle q.a))
|
||||
=+ tan=(turn quy |=([p=@t q=@t] [(trip p) (trip q)]))
|
||||
=+ har=(help (turn tan |=(p=[p=tape q=tape] [p.p (urle q.p)])))
|
||||
=+ hab=(help tan)
|
||||
=+ lav=(reel har |=([p=tape q=tape] :(weld p "&" q)))
|
||||
=+ voy=?:(=(0 (lent lav)) ~ (scag (dec (lent lav)) `tape`lav))
|
||||
=+ vab=(reel hab |=([p=tape q=tape] :(weld p "&" q)))
|
||||
=+ vur=(crip ?:(=(0 (lent vab)) ~ (scag (dec (lent vab)) `tape`vab)))
|
||||
=+ ^= head
|
||||
%- ~(gas by *math)
|
||||
:~ ['authorization' [(oauth med url hab key est eny) ~]]
|
||||
['content-type' ['application/x-www-form-urlencoded' ~]]
|
||||
==
|
||||
?: =(%get med)
|
||||
?~ voy
|
||||
[(req url) med head ~]
|
||||
[(req :(weld url "?" voy)) med head ~]
|
||||
[(req url) med head (some [(met 3 vur) vur])]
|
||||
--
|
||||
!:
|
||||
:::: library
|
||||
::
|
||||
|%
|
||||
++ twip :: response printers
|
||||
|%
|
||||
++ mean
|
||||
|= [msg=@t num=@ud] ^- tank
|
||||
rose/[": " `~]^~[leaf/"Error {<num>}" leaf/(trip msg)]
|
||||
--
|
||||
++ twir :: response parsers
|
||||
|%
|
||||
++ fasp |*([a=@tas b=*] [(gsub '-' '_' a) b])
|
||||
++ user (cook crip (plus ;~(pose aln cab)))
|
||||
++ mean (ot errors/(ar (ot message/so code/ni ~)) ~):jo
|
||||
++ stat
|
||||
=+ jo
|
||||
^- $+(json (unit ,[id=@u who=@ta now=@da txt=@t]))
|
||||
%- ot
|
||||
:~ id/ni
|
||||
user/(ot (fasp screen-name/(su user)) ~)
|
||||
(fasp created-at/da)
|
||||
text/so
|
||||
==
|
||||
++ usel
|
||||
=+ jo
|
||||
^- $+(json (unit (list ,who=@ta)))
|
||||
=- (ot users/(ar -) ~)
|
||||
(ot (fasp screen-name/(su user)) ~)
|
||||
--
|
||||
++ twit
|
||||
=> |% :: request structures
|
||||
++ dev ,@t :: device name
|
||||
++ gat ,@t :: grant type
|
||||
++ lat ,@t :: latitude
|
||||
++ lid (list tid)
|
||||
++ lon ,@t :: longitude
|
||||
++ lsc (list scr)
|
||||
++ lst (list ,@t)
|
||||
++ nam ,@t :: location name
|
||||
++ pla ,@t :: place-id
|
||||
++ scr ,@t :: screen name
|
||||
++ slu ,@t :: category name
|
||||
++ tid ,@u
|
||||
++ tok ,@t :: oauth token
|
||||
++ url ,@t :: callback url
|
||||
::
|
||||
++ at ,[%access-token p=tok]
|
||||
++ de ,[%device p=dev]
|
||||
++ fo ,[%follow p=lid]
|
||||
++ gr ,[%grant-type p=gat]
|
||||
++ id ,[%id p=tid]
|
||||
++ ii ,[%'!inline' p=@t]
|
||||
++ is ,[%id p=lid]
|
||||
++ la ,[%lat p=lat]
|
||||
++ lo ,[%long p=lon]
|
||||
++ na ,[%name p=lid]
|
||||
++ oa ,[%oauth-callback p=url]
|
||||
++ os ,[%source-screen-name p=scr]
|
||||
++ pl ,[%place-id p=pla]
|
||||
++ qq ,[%q p=@t]
|
||||
++ sc ,[%screen-name p=scr]
|
||||
++ sd ?(ui sc)
|
||||
++ ss ,[%screen-name p=lsc]
|
||||
++ sl ,[%slug p=slu]
|
||||
++ si ,[%source-id p=tid]
|
||||
++ st ,[%status p=@t]
|
||||
++ te ,[%text p=@t]
|
||||
++ ti ,[%target-id p=tid]
|
||||
++ ts ,[%target-screen-name p=scr]
|
||||
++ tr ,[%track p=lst]
|
||||
++ ur ,[%url p=url]
|
||||
++ ui ,[%user-id p=tid]
|
||||
++ us ,[%user-id p=lid]
|
||||
--
|
||||
|_ [key=keys est=time eny=@uw]
|
||||
++ lutt |=(@ `@t`(rsh 3 2 (scot %ui +<)))
|
||||
++ llsc
|
||||
|= (list scr)
|
||||
(roll +< |=([p=scr q=@t] (cat 3 (cat 3 q ',') p)))
|
||||
::
|
||||
++ llst
|
||||
|= (list ,@t)
|
||||
(roll +< |=([p=@t q=@t] (cat 3 (cat 3 q ',') p)))
|
||||
::
|
||||
++ llid
|
||||
|= (list tid)
|
||||
(roll +< |=([p=tid q=@t] (cat 3 (cat 3 q ',') (lutt p))))
|
||||
::
|
||||
++ mold :: construct request
|
||||
|* [med=meth pax=path a=$+(* *)]
|
||||
|= [args=a quy=quay]
|
||||
(valve med (cowl pax args quy) key est eny)
|
||||
::
|
||||
++ cowl :: handle parameters
|
||||
|= $: pax=path
|
||||
ban=(list ,[p=@t q=?(@ (list ,@))])
|
||||
quy=quay
|
||||
==
|
||||
^- [path quay]
|
||||
?~ ban
|
||||
[(fass pax) quy]
|
||||
?: =('!inline' p.i.ban)
|
||||
?@ q.i.ban
|
||||
[(fass (welp pax /[`@t`q.i.ban])) quy]
|
||||
!!
|
||||
:- (fass pax)
|
||||
%+ welp quy
|
||||
%+ turn `(list ,[p=@t q=?(@ (list ,@))])`ban
|
||||
|= [p=@t q=?(@ (list ,@))]
|
||||
^- [@t @t]
|
||||
:- (gsub '-' '_' p)
|
||||
?@ q
|
||||
?- p
|
||||
?(%id %source-id %target-id %user-id) (lutt q)
|
||||
@ `@t`q
|
||||
==
|
||||
?- p
|
||||
?(%follow %id %name %user-id) (llid q)
|
||||
%track (llst q)
|
||||
%screen-name (llsc q)
|
||||
* !!
|
||||
==
|
||||
::
|
||||
++ stat-ment
|
||||
(mold %get /statuses/mentions-timeline ,~)
|
||||
::
|
||||
++ stat-user
|
||||
(mold %get /statuses/user-timeline ,[sd ~])
|
||||
::
|
||||
++ stat-home
|
||||
(mold %get /statuses/home-timeline ,~)
|
||||
::
|
||||
++ stat-retw
|
||||
(mold %get /statuses/retweets-of-me ,~)
|
||||
::
|
||||
++ stat-rets-iddd
|
||||
(mold %get /statuses/retweets ,[ii ~])
|
||||
::
|
||||
++ stat-show
|
||||
(mold %get /statuses/show ,[id ~])
|
||||
::
|
||||
++ stat-dest-iddd
|
||||
(mold %post /statuses/destroy ,[ii ~])
|
||||
::
|
||||
++ stat-upda
|
||||
(mold %post /statuses/update ,[st ~])
|
||||
::
|
||||
++ stat-retw-iddd
|
||||
(mold %post /statuses/retweet ,[ii ~])
|
||||
::
|
||||
++ stat-oemb-iddd
|
||||
(mold %get /statuses/oembed ,[id ~])
|
||||
::
|
||||
++ stat-oemb-urll
|
||||
(mold %get /statuses/oembed ,[ur ~])
|
||||
::
|
||||
++ stat-retw-idss
|
||||
(mold %get /statuses/retweeters/ids ,[id ~])
|
||||
::
|
||||
++ sear-twee
|
||||
(mold %get /search/tweets ,[qq ~])
|
||||
::
|
||||
++ stat-filt-foll
|
||||
(mold %post /statuses/filter ,[?(fo tr) ~])
|
||||
::
|
||||
++ stat-samp
|
||||
(mold %get /statuses/sample ,~)
|
||||
::
|
||||
++ stat-fire
|
||||
(mold %get /statuses/firehose ,~)
|
||||
::
|
||||
++ user
|
||||
(mold %get /user ,~)
|
||||
::
|
||||
++ site
|
||||
(mold %get /site ,[fo ~])
|
||||
::
|
||||
++ dire
|
||||
(mold %get /direct-messages ,~)
|
||||
::
|
||||
++ dire-sent
|
||||
(mold %get /direct-messages/sent ,~)
|
||||
::
|
||||
++ dire-show
|
||||
(mold %get /direct-messages/show ,[id ~])
|
||||
::
|
||||
++ dire-dest
|
||||
(mold %post /direct-messages/destroy ,[id ~])
|
||||
::
|
||||
++ dire-neww
|
||||
(mold %post /direct-messages/new ,[sd te ~])
|
||||
::
|
||||
++ frie-nore-idss
|
||||
(mold %get /friendships/no-retweets/ids ,~)
|
||||
::
|
||||
++ frie-idss
|
||||
(mold %get /friends/ids ,[sd ~])
|
||||
::
|
||||
++ foll-idss
|
||||
(mold %get /followers/ids ,[sd ~])
|
||||
::
|
||||
++ frie-inco
|
||||
(mold %get /friendships/incoming ,~)
|
||||
::
|
||||
++ frie-outg
|
||||
(mold %get /friendships/outgoing ,~)
|
||||
::
|
||||
++ frie-crea
|
||||
(mold %post /friendships/create ,[sd ~])
|
||||
::
|
||||
++ frie-dest
|
||||
(mold %post /friendships/destroy ,[sd ~])
|
||||
::
|
||||
++ frie-upda
|
||||
(mold %post /friendships/update ,[sd ~])
|
||||
::
|
||||
++ frie-show
|
||||
(mold %get /friendships/show ,[?(si os) ?(ti ts) ~])
|
||||
::
|
||||
++ frie-list
|
||||
(mold %get /friends/list ,[sd ~])
|
||||
::
|
||||
++ foll-list
|
||||
(mold %get /followers/list ,[sd ~])
|
||||
::
|
||||
++ frie-look
|
||||
(mold %get /friendships/lookup ,[?(us ss) ~])
|
||||
::
|
||||
++ acco-sett-gett
|
||||
(mold %get /account/settings ,~)
|
||||
::
|
||||
++ acco-veri
|
||||
(mold %get /account/verify-credentials ,~)
|
||||
::
|
||||
++ acco-sett-post
|
||||
(mold %post /account/settings ,~)
|
||||
::
|
||||
++ acco-upda-deli
|
||||
(mold %post /account/update-delivery-device ,[de ~])
|
||||
::
|
||||
++ acco-upda-prof
|
||||
(mold %post /account/update-profile ,~)
|
||||
::
|
||||
++ acco-upda-prof-back
|
||||
(mold %post /account/update-profile-background-image ,~)
|
||||
::
|
||||
++ acco-upda-prof-colo
|
||||
(mold %post /account/update-profile-colors ,~)
|
||||
::
|
||||
++ bloc-list
|
||||
(mold %get /blocks/list ,~)
|
||||
::
|
||||
++ bloc-idss
|
||||
(mold %get /blocks/ids ,~)
|
||||
::
|
||||
++ bloc-crea
|
||||
(mold %post /blocks/create ,[sd ~])
|
||||
::
|
||||
++ bloc-dest
|
||||
(mold %post /blocks/destroy ,[sd ~])
|
||||
::
|
||||
++ user-look
|
||||
(mold %get /users/lookup ,[?(us ss) ~])
|
||||
::
|
||||
++ user-show
|
||||
(mold %get /users/show ,[sd ~])
|
||||
::
|
||||
++ user-sear
|
||||
(mold %get /users/search ,[qq ~])
|
||||
::
|
||||
++ user-cont-tees
|
||||
(mold %get /users/contributees ,[sd ~])
|
||||
::
|
||||
++ user-cont-tors
|
||||
(mold %get /users/contributors ,[sd ~])
|
||||
::
|
||||
++ acco-remo
|
||||
(mold %post /account/remove-profile-banner ,~)
|
||||
::
|
||||
++ user-prof
|
||||
(mold %get /users/profile-banner ,[sd ~])
|
||||
::
|
||||
++ mute-user-crea
|
||||
(mold %post /mutes/users/create ,[sd ~])
|
||||
::
|
||||
++ mute-user-dest
|
||||
(mold %post /mutes/users/destroy ,[sd ~])
|
||||
::
|
||||
++ mute-user-idss
|
||||
(mold %get /mutes/users/ids ,~)
|
||||
::
|
||||
++ mute-user-list
|
||||
(mold %get /mutes/users/list ,~)
|
||||
::
|
||||
++ user-sugg-slug
|
||||
(mold %get /users/suggestions ,[sl ~])
|
||||
::
|
||||
++ user-sugg
|
||||
(mold %get /users/suggestions ,~)
|
||||
::
|
||||
++ favo-list
|
||||
(mold %get /favorites/list ,~)
|
||||
::
|
||||
++ favo-dest
|
||||
(mold %post /favorites/destroy ,[id ~])
|
||||
::
|
||||
++ favo-crea
|
||||
(mold %post /favorites/create ,[id ~])
|
||||
::
|
||||
++ list-list
|
||||
(mold %get /lists/list ,~)
|
||||
::
|
||||
++ list-stat
|
||||
(mold %get /lists/statuses ,~)
|
||||
::
|
||||
++ list-memb-dest
|
||||
(mold %post /lists/members/destroy ,~)
|
||||
::
|
||||
++ list-memb-hips
|
||||
(mold %get /lists/memberships ,[sd ~])
|
||||
::
|
||||
++ list-subs-bers
|
||||
(mold %get /lists/subscribers ,~)
|
||||
::
|
||||
++ list-subs-crea
|
||||
(mold %post /lists/subscribers/create ,~)
|
||||
::
|
||||
++ list-subs-show
|
||||
(mold %get /lists/subscribers/show ,[sd ~])
|
||||
::
|
||||
++ list-subs-dest
|
||||
(mold %post /lists/subscribers/destroy ,~)
|
||||
::
|
||||
++ list-memb-crea-alll
|
||||
(mold %post /lists/members/create-all ,[?(us ss) ~])
|
||||
::
|
||||
++ list-memb-show
|
||||
(mold %get /lists/members/show ,[sd ~])
|
||||
::
|
||||
++ list-memb-bers
|
||||
(mold %get /lists/members ,~)
|
||||
::
|
||||
++ list-memb-crea
|
||||
(mold %post /lists/members/create ,[sd ~])
|
||||
::
|
||||
++ list-dest
|
||||
(mold %post /lists/destroy ,~)
|
||||
::
|
||||
++ list-upda
|
||||
(mold %post /lists/update ,~)
|
||||
::
|
||||
++ list-crea
|
||||
(mold %post /lists/create ,[na ~])
|
||||
::
|
||||
++ list-show
|
||||
(mold %get /lists/show ,~)
|
||||
::
|
||||
++ list-subs-ions
|
||||
(mold %get /lists/subscriptions ,[sd ~])
|
||||
::
|
||||
++ list-memb-dest-alll
|
||||
(mold %post /lists/members/destroy-all ,[?(us ss) ~])
|
||||
::
|
||||
++ list-owne
|
||||
(mold %get /lists/ownerships ,[sd ~])
|
||||
::
|
||||
++ save-list
|
||||
(mold %get /saved-searches/list ,~)
|
||||
::
|
||||
++ save-show-iddd
|
||||
(mold %get /saved-searches/show ,[ii ~])
|
||||
::
|
||||
++ save-crea
|
||||
(mold %post /saved-searches/create ,[qq ~])
|
||||
::
|
||||
++ save-dest-iddd
|
||||
(mold %post /saved-searches/destroy ,[ii ~])
|
||||
::
|
||||
++ geoo-iddd-plac
|
||||
(mold %get /geo/id ,[ii ~])
|
||||
::
|
||||
++ geoo-reve
|
||||
(mold %get /geo/reverse-geocode ,[la lo ~])
|
||||
::
|
||||
++ geoo-sear
|
||||
(mold %get /geo/search ,~)
|
||||
::
|
||||
++ geoo-simi
|
||||
(mold %get /geo/similar-places ,[la lo na ~])
|
||||
::
|
||||
++ tren-plac
|
||||
(mold %get /trends/place ,[id ~])
|
||||
::
|
||||
++ tren-avai
|
||||
(mold %get /trends/available ,~)
|
||||
::
|
||||
++ tren-clos
|
||||
(mold %get /trends/closest ,[la lo ~])
|
||||
::
|
||||
++ user-repo
|
||||
(mold %post /users/report-spam ,[sd ~])
|
||||
::
|
||||
++ oaut-auth-cate
|
||||
(mold %get /oauth/authenticate ,~)
|
||||
::
|
||||
++ oaut-auth-rize
|
||||
(mold %get /oauth/authorize ,~)
|
||||
::
|
||||
++ oaut-acce
|
||||
(mold %post /oauth/access-token ,~)
|
||||
::
|
||||
++ oaut-requ
|
||||
(mold %post /oauth/request-token ,[oa ~])
|
||||
::
|
||||
++ oaut-toke
|
||||
(mold %post /oauth2/token ,[gr ~])
|
||||
::
|
||||
++ oaut-inva
|
||||
(mold %post /oauth2/invalidate-token ,[at ~])
|
||||
::
|
||||
++ help-conf
|
||||
(mold %get /help/configuration ,~)
|
||||
::
|
||||
++ help-lang
|
||||
(mold %get /help/languages ,~)
|
||||
::
|
||||
++ help-priv
|
||||
(mold %get /help/privacy ,~)
|
||||
::
|
||||
++ help-toss
|
||||
(mold %get /help/tos ,~)
|
||||
::
|
||||
++ appl-rate
|
||||
(mold %get /application/rate-limit-status ,~)
|
||||
::
|
||||
++ stat-look
|
||||
(mold %get /statuses/lookup ,[us ~])
|
||||
--
|
||||
--
|
@ -1,12 +0,0 @@
|
||||
::
|
||||
:::: /hoon/octo-game/mar
|
||||
::
|
||||
/? 310
|
||||
!:
|
||||
|_ cod=[who=? box=@ boo=@] :: game state
|
||||
::
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ noun ,[who=? box=@ boo=@] :: clam from %noun
|
||||
--
|
||||
--
|
@ -1,16 +0,0 @@
|
||||
::
|
||||
:::: /hoon/oct3-move/mar
|
||||
::
|
||||
/? 314
|
||||
!:
|
||||
::::
|
||||
::
|
||||
=+ point=,[x=@ y=@]
|
||||
|_ point
|
||||
::
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ json (corl need (at ni ni ~):jo) :: reparse from %json
|
||||
++ noun point :: clam from %noun
|
||||
--
|
||||
--
|
@ -1,35 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct3-update/mar :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo
|
||||
/- oct3 :: structures
|
||||
/+ oct3 :: libraries
|
||||
[. oct3 ^oct3]
|
||||
!: :: ::
|
||||
:::: :: :: protocol
|
||||
:: :: ::
|
||||
|_ play :: game
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ noun play :: from %noun
|
||||
--
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ json ^- ^json :: to %json
|
||||
~! +>-<
|
||||
?: ?=(| +>-<)
|
||||
~! +>-<
|
||||
~! p
|
||||
s/(crip p)
|
||||
=+ she=|=(ship s/(scot %p +<))
|
||||
=+ hes=|=([ship *] (she +<-))
|
||||
%- jobe
|
||||
:~ who/s/?:(who.p %x %o)
|
||||
plx/?~(p.sag.p ~ (she u.p.sag.p))
|
||||
plo/?~(q.sag.p ~ (she u.q.sag.p))
|
||||
aud/a/(turn (~(tap by aud.p)) hes)
|
||||
box/~(jon bo box.p)
|
||||
boo/~(jon bo boo.p)
|
||||
==
|
||||
--
|
||||
--
|
@ -1,16 +0,0 @@
|
||||
::
|
||||
:::: /hoon/oct4-move/mar
|
||||
::
|
||||
/? 314
|
||||
!:
|
||||
::::
|
||||
::
|
||||
=+ point=,[x=@ y=@]
|
||||
|_ point
|
||||
::
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ json (corl need (at ni ni ~):jo) :: reparse from %json
|
||||
++ noun point :: clam from %noun
|
||||
--
|
||||
--
|
@ -1,35 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct4-update/mar :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo
|
||||
/- oct4 :: structures
|
||||
/+ oct4 :: libraries
|
||||
!: :: ::
|
||||
:::: :: :: protocol
|
||||
:: :: ::
|
||||
[oct4 ^oct4 .]
|
||||
|_ play :: game
|
||||
++ grab :: convert from
|
||||
|%
|
||||
++ noun play :: from %noun
|
||||
--
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ json ^- ^json :: to %json
|
||||
~! +>-<
|
||||
?: ?=(| +>-<)
|
||||
~! +>-<
|
||||
~! p
|
||||
s/(crip p)
|
||||
=+ she=|=(ship s/(scot %p +<))
|
||||
=+ hes=|=([ship *] (she +<-))
|
||||
%- jobe
|
||||
:~ who/s/?:(who.p %x %o)
|
||||
plx/?~(p.sag.p ~ (she u.p.sag.p))
|
||||
plo/?~(q.sag.p ~ (she u.q.sag.p))
|
||||
aud/a/(turn (~(tap by aud.p)) hes)
|
||||
box/~(jon bo box.p)
|
||||
boo/~(jon bo boo.p)
|
||||
==
|
||||
--
|
||||
--
|
@ -1,28 +0,0 @@
|
||||
!:
|
||||
:::: /hoon/core/sched/mar
|
||||
::
|
||||
|_ dat=(map ,@da cord)
|
||||
++ grow :: convert to
|
||||
|% ++ mime [/text/x-sched (tact tape)]
|
||||
++ tape
|
||||
(zing `wall`(turn sorted-list |=([a=@da b=cord] "{<a>} {(trip b)}\0a")))
|
||||
++ elem =< ;ul: *{(turn sorted-list .)}
|
||||
|= [tym=@da ite=cord] ^- manx
|
||||
;li: ;{b "{<tym>}"}: {(trip ite)}
|
||||
++ sorted-list
|
||||
(sort (~(tap by dat)) |=([[l=@ @] [r=@ @]] (lth l r)))
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
++ mime
|
||||
|= [p=mite q=octs] ^+ dat
|
||||
=< (mo (turn (lore q.q) .))
|
||||
|= a=@t ^- [@da @t]
|
||||
%+ rash a
|
||||
;~ (glue ace)
|
||||
(cook |=(a=coin ?>(?=([~ %da @] a) `@da`q.p.a)) nuck:so)
|
||||
(cook crip (star prn))
|
||||
==
|
||||
--
|
||||
++ grad %mime
|
||||
--
|
@ -1,104 +0,0 @@
|
||||
::
|
||||
:::: /hoon/command/work/mar
|
||||
::
|
||||
/- work
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[work .]
|
||||
|_ mad=command
|
||||
++ grab
|
||||
|% ++ noun command
|
||||
++ json
|
||||
=> [jo ..command]
|
||||
=< (corl need (cu |=(a=command a) coma))
|
||||
|%
|
||||
++ as
|
||||
:: |*(a=fist (cu sa (ar a))) :: XX types
|
||||
|* a=fist
|
||||
%- cu :_ (ar a)
|
||||
~(gas in *(set ,_(need *a)))
|
||||
++ ot
|
||||
|* a=(pole ,[@tas fist])
|
||||
|= b=json
|
||||
%. ((^ot a) b)
|
||||
%- slog
|
||||
?+ b ~
|
||||
[%o *]
|
||||
%+ murn `(list ,[@tas fist])`a
|
||||
|= [c=term d=fist] ^- (unit tank)
|
||||
=+ (~(get by p.b) c)
|
||||
?~ - (some >[c (turn (~(tap by p.b)) head)]<)
|
||||
=+ (d u)
|
||||
?~ - (some >[c u]<)
|
||||
~
|
||||
==
|
||||
++ of
|
||||
|* a=(pole ,[@tas fist])
|
||||
|= b=json
|
||||
%. ((of:jo a) b)
|
||||
%- slog
|
||||
?+ b ~
|
||||
[%o *]
|
||||
%+ murn `(list ,[@tas fist])`a
|
||||
|= [c=term d=fist] ^- (unit tank)
|
||||
=+ (~(get by p.b) c)
|
||||
?~ - ~
|
||||
=+ (d u)
|
||||
?~ - (some >[c u]<)
|
||||
~
|
||||
==
|
||||
++ id (ci (slat %uv) so)
|
||||
++ ship (su fed:ag)
|
||||
++ coma
|
||||
%- of :~
|
||||
new/task old/(ot id/id dif/uppd ~)
|
||||
sort/(ar id)
|
||||
==
|
||||
++ task
|
||||
%- ot :~
|
||||
::index/ni
|
||||
audience/audi
|
||||
id/id 'date_created'^di
|
||||
version/ni 'date_modified'^di
|
||||
creator/ship doer/(mu ship)
|
||||
tags/(as so) 'date_due'^(mu di)
|
||||
done/(mu di) title/so
|
||||
description/so discussion/(ar (ot date/di ship/ship body/so ~))
|
||||
==
|
||||
++ audi (as stan)
|
||||
++ stan (su ;~((glue fas) ;~(pfix sig fed:ag) urs:ab))
|
||||
++ uppd
|
||||
%- of :~
|
||||
doer/(of release/ul claim/ul ~)
|
||||
add/(of comment/so ~)
|
||||
:- %set
|
||||
%- of :~
|
||||
audience/audi
|
||||
date-due/(mu di)
|
||||
title/so
|
||||
description/so
|
||||
tags/(as so)
|
||||
done/bo
|
||||
==
|
||||
==
|
||||
--
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ elem ;pre: {(zing `wall`(turn (wash 0^120 >mad<) |=(a=tape ['\0a' a])))}
|
||||
--
|
||||
--
|
||||
:: {new: {
|
||||
:: id:'0vaof.6df9u.2agc3.d0dp1',
|
||||
:: date-created:1440011611215,
|
||||
:: version:1,
|
||||
:: date-modified:1440011611215,
|
||||
:: creator:'fyr',
|
||||
:: tags:['tag'],
|
||||
:: date-due:null,
|
||||
:: done:false,
|
||||
:: title:'Test task',
|
||||
:: description:'The converter owrks right?',
|
||||
:: discussion:[{date:1440011611215,ship:'sondel',body:'hi'}]
|
||||
:: } }
|
@ -1,55 +0,0 @@
|
||||
::
|
||||
:::: /hoon/report/work/mar
|
||||
::
|
||||
/- work
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[work .]
|
||||
|_ client
|
||||
++ grow
|
||||
|% ++ json
|
||||
=+ jope=|=(a=ship [%s (rsh 3 1 (scot %p a))])
|
||||
%- jobe :~
|
||||
sort/[%a (turn sort |=(a=@uv [%s (scot %uv a)]))]
|
||||
=< tasks/(jobe (turn (~(tap by tasks)) .))
|
||||
|= [@ client-task]
|
||||
=+ tax
|
||||
:- (scot %uv id)
|
||||
%- jobe :~ id/[%s (scot %uv id)]
|
||||
tags/[%a (turn (^sort (~(tap in tags)) aor) |=(a=cord s/a))]
|
||||
doer/?~(doer ~ (jope u.doer))
|
||||
title/[%s title]
|
||||
creator/(jope creator)
|
||||
version/(jone version)
|
||||
archived/[%b archived]
|
||||
=< audience/[%a (turn (~(tap in audience)) .)]
|
||||
|=(a=station:talk [%s (crip "{<p.a>}/{(trip q.a)}")])
|
||||
'date_created'^(jode date-created)
|
||||
'date_modified'^(jode date-modified)
|
||||
description/[%s description]
|
||||
=< discussion/[%a (turn discussion .)]
|
||||
|=(comment (jobe date/(jode date) ship/(jope ship) body/[%s body] ~))
|
||||
'date_due'^?~(date-due ~ (jode u.date-due))
|
||||
done/?~(done ~ (jode u.done))
|
||||
==
|
||||
==
|
||||
-- --
|
||||
:: sort: ["0v111id" ...]
|
||||
:: tasks: [ {
|
||||
:: id:"0v111id"
|
||||
:: tags:["str" ...]
|
||||
:: doer:|("~ship" null)
|
||||
:: title:"str"
|
||||
:: creator:"~ship"
|
||||
:: version:12345
|
||||
:: archived:false
|
||||
:: audience:["~ship/chan" ...]
|
||||
:: date_created:1262304000000
|
||||
:: date_modified:1262304000000
|
||||
:: description:"str"
|
||||
:: discussion:[{date:1262304000000 ship:"~ship" body:"str"} ...]
|
||||
:: date_due:?(1262304000000 null)
|
||||
:: done:?(1262304000000 null)
|
||||
:: }
|
||||
:: ...]
|
@ -1,105 +0,0 @@
|
||||
::
|
||||
:::: /hoon/task/work/mar
|
||||
::
|
||||
/- work
|
||||
!:
|
||||
::::
|
||||
::
|
||||
[work .]
|
||||
|%
|
||||
++ rend
|
||||
|= a=(list $|(char dime)) ^- cord
|
||||
%- crip
|
||||
|- ^- tape
|
||||
?~ a ~
|
||||
?@ i.a [i.a $(a t.a)]
|
||||
(weld (scow i.a) $(a t.a))
|
||||
::
|
||||
++ indent |=(a=wain (turn a |=(b=cord (cat 3 ' ' b))))
|
||||
::
|
||||
++ undent
|
||||
|* [a=wain b=$+(wain *)] ^+ [*b a]
|
||||
=^ c a
|
||||
|- ^- [c=wain a=wain]
|
||||
?~ a [~ a]
|
||||
?. =(' ' (end 3 2 i.a))
|
||||
[~ a]
|
||||
[[- c] a]:[(rsh 3 2 i.a) $(a t.a)]
|
||||
[(b `wain`c) a]
|
||||
++ keen |*(_[a=,* b=rule] |=(c=nail `(like a)`(b c)))
|
||||
++ parse
|
||||
|* [hed=?(~ $|(@tas tape)) tal=(pole)]
|
||||
?~ hed (..$ tal)
|
||||
?^ hed ;~(pfix (just (crip hed)) (..$ tal))
|
||||
=- ?~(tal had ;~(plug had (..$ tal)))
|
||||
=< had=(sear . nuck:so)
|
||||
|= a=coin ^- (unit (odo:raid hed))
|
||||
?. &(?=([%$ @ @] a) =(hed p.p.a)) ~
|
||||
(some q.p.a)
|
||||
::
|
||||
++ advance
|
||||
|* [a=wain b=_rule] ^+ [(wonk *b) a]
|
||||
?~(a !! ~|(i.a [(rash i.a b) t.a]))
|
||||
--
|
||||
!:
|
||||
::::
|
||||
::
|
||||
|_ taz=task
|
||||
++ grab
|
||||
|% ++ txt
|
||||
|= a=wain ^+ taz
|
||||
=+ ~[id=%uv "_" date-created=%da " " version=%ud date-modified=%da]
|
||||
=^ b a (advance a ;~(plug (parse -) (punt (parse " " %da ~))))
|
||||
=+ [-.b `date-due=(unit ,@da)`+.b]
|
||||
=^ tags a (undent a ~(gas in *(set cord)))
|
||||
=^ title a ?~(a !! a)
|
||||
=^ b a %+ advance a
|
||||
;~(plug (parse %p ~) (punt (parse ">" %p ~)) (punt (parse "X" %da ~)))
|
||||
=+ `[creator=@p doer=(unit ,@p) done=(unit ,@da)]`b
|
||||
=^ description a (undent a role)
|
||||
:* id date-created version date-modified creator
|
||||
doer tags date-due done title description :: XX done
|
||||
|- ^- (list comment)
|
||||
?: =(~ a) ~
|
||||
=^ b a (advance a (parse ship=%p " " date=%da ~))
|
||||
=+ b
|
||||
=^ body a (undent a role)
|
||||
[[date ship body] $]
|
||||
==
|
||||
--
|
||||
++ grow
|
||||
|%
|
||||
++ elem ;pre: {(zing `wall`(turn (wash 0^120 >taz<) |=(a=tape ['\0a' a])))}
|
||||
++ mime [/text/x-task (taco (role txt))]
|
||||
++ txt
|
||||
=+ taz
|
||||
=+ due=?~(date-due ~ ~[' ' da/u.date-due])
|
||||
:- (rend uv/id '_' da/date-created ' ' ud/version da/date-modified due)
|
||||
%+ welp (indent (sort (~(tap in tags)) aor))
|
||||
:- title
|
||||
=+ do=[=-(?~(doer - ['>' p/u.doer -]) ?~(done ~ ~['X' da/u.done]))]
|
||||
:- (rend p/creator do)
|
||||
%- zing ^- (list wain)
|
||||
:- (indent (lore description))
|
||||
%+ turn discussion
|
||||
|= comment ^- wain
|
||||
[(rend p/ship ' ' da/date ~) (indent (lore body))]
|
||||
--
|
||||
++ grad %txt
|
||||
--
|
||||
:: {id}_{date-created} {version}{date-modified}{|(" {date-due}" ~)}
|
||||
:: {tag1}
|
||||
:: {tag2}
|
||||
:: ...
|
||||
:: {title}
|
||||
:: {creator}{|(">{doer}" ~)}{|("X{done}" ~)}
|
||||
:: {description}
|
||||
:: {more description}
|
||||
:: {ship1} {date}
|
||||
:: {comment}
|
||||
:: {more comment}
|
||||
:: {more comment}
|
||||
:: {ship2} {date}
|
||||
:: {comment}
|
||||
:: {more comment}
|
||||
:: {more comment}
|
@ -1,39 +0,0 @@
|
||||
A noun is an atom or a cell.
|
||||
An atom is a natural number.
|
||||
A cell is an ordered pair of nouns.
|
||||
|
||||
nock(a) *a
|
||||
[a b c] [a [b c]]
|
||||
|
||||
?[a b] 0
|
||||
?a 1
|
||||
+[a b] +[a b]
|
||||
+a 1 + a
|
||||
=[a a] 0
|
||||
=[a b] 1
|
||||
=a =a
|
||||
|
||||
/[1 a] a
|
||||
/[2 a b] a
|
||||
/[3 a b] b
|
||||
/[(a + a) b] /[2 /[a b]]
|
||||
/[(a + a + 1) b] /[3 /[a b]]
|
||||
/a /a
|
||||
|
||||
*[a [b c] d] [*[a b c] *[a d]]
|
||||
|
||||
*[a 0 b] /[b a]
|
||||
*[a 1 b] b
|
||||
*[a 2 b c] *[*[a b] *[a c]]
|
||||
*[a 3 b] ?*[a b]
|
||||
*[a 4 b] +*[a b]
|
||||
*[a 5 b] =*[a b]
|
||||
|
||||
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
|
||||
*[a 7 b c] *[a 2 b 1 c]
|
||||
*[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
|
||||
*[a 9 b c] *[a 7 c 2 [0 1] 0 b]
|
||||
*[a 10 [b c] d] *[a 8 c 7 [0 3] d]
|
||||
*[a 10 b c] *[a c]
|
||||
|
||||
*a *a
|
@ -1,18 +0,0 @@
|
||||
|%
|
||||
++ bit-any
|
||||
$% [%bit-get-token bit-get-token]
|
||||
[%bit-api-call tok=@t bit-api-call]
|
||||
==
|
||||
++ bit-api-call
|
||||
$% [%send bit-send]
|
||||
[%txt-send to=@t btc=@t]
|
||||
[%buy amount=@t currency=@t]
|
||||
[%sell amount=@t currency=@t]
|
||||
[%list ~]
|
||||
==
|
||||
++ bit-send ,[adr=@uc btc=@t]
|
||||
++ bit-ship-send ,[who=@p btc=@t]
|
||||
++ bit-get-token ,[oat=@t [cid=@t sec=@t] red=purl]
|
||||
++ bit-accounts (list ,[id=@t name=@t balance=[num=@t cur=term]])
|
||||
--
|
||||
|
@ -1,16 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct1/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board ,@ :: one-player bitfield
|
||||
++ point ,[x=@ y=@] :: coordinate
|
||||
++ game :: game state
|
||||
$: who=? :: whose turn
|
||||
box=board :: X board
|
||||
boo=board :: O board
|
||||
== ::
|
||||
--
|
@ -1,19 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct2/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board ,@ :: one-player bitfield
|
||||
++ point ,[x=@ y=@] :: coordinate
|
||||
++ stage (pair (unit ship) (unit ship)) :: players
|
||||
++ game :: game state
|
||||
$: who=? :: whose turn
|
||||
sag=stage :: who's playing
|
||||
aud=(map ship ,@ud) :: who's watching
|
||||
box=board :: X board
|
||||
boo=board :: O board
|
||||
== ::
|
||||
--
|
@ -1,20 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct3/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 :: arvo version
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board ,@ :: one-player bitfield
|
||||
++ point ,[x=@ y=@] :: coordinate
|
||||
++ stage (pair (unit ship) (unit ship)) :: players
|
||||
++ play (each game tape) :: update
|
||||
++ game :: game state
|
||||
$: who=? :: whose turn
|
||||
sag=stage :: who's playing
|
||||
aud=(map ship ,@ud) :: who's watching
|
||||
box=board :: X board
|
||||
boo=board :: O board
|
||||
== ::
|
||||
--
|
@ -1,20 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hoon/oct4/sur :::::: dependencies
|
||||
:: :: ::
|
||||
/? 310 ::
|
||||
:: :: ::
|
||||
:::: :::::: semantics
|
||||
:: :: ::
|
||||
|% ::
|
||||
++ board ,@ :: one-player bitfield
|
||||
++ point ,[x=@ y=@] :: coordinate
|
||||
++ stage (pair (unit ship) (unit ship)) :: players
|
||||
++ play (each game tape) :: update
|
||||
++ game :: game state
|
||||
$: who=? :: whose turn
|
||||
sag=stage :: who's playing
|
||||
aud=(map ship ,@ud) :: who's watching
|
||||
box=board :: X board
|
||||
boo=board :: O board
|
||||
== ::
|
||||
--
|
@ -1,16 +0,0 @@
|
||||
|%
|
||||
++ twit-do => twit ,[p=span q=command] :: user and action
|
||||
++ twit-stat ,[id=@u who=@ta now=@da txt=@t] :: recieved tweet
|
||||
++ twit
|
||||
|%
|
||||
++ keys :: twitter-key type
|
||||
$: con=[tok=@t sec=@t] :: user key pair
|
||||
acc=[tok=@t sec=@t] :: app key pair
|
||||
==
|
||||
::
|
||||
++ command :: poke action
|
||||
$% [%auth p=keys] :: set API keys
|
||||
[%post p=@uvI q=cord] :: post a tweet
|
||||
==
|
||||
--
|
||||
--
|
@ -1,3 +0,0 @@
|
||||
/=try=/
|
||||
|
||||
This is the try desk. Feel free to try out whatever you want here.
|
@ -1,37 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/= gas /$ fuel
|
||||
::
|
||||
:::: ~sivtyv-barnel
|
||||
::
|
||||
!:
|
||||
^- manx
|
||||
|
||||
=+ authcode=(fall (~(get by qix.gas) %'code') '')
|
||||
;html
|
||||
;head
|
||||
;title: Coinbase Auth
|
||||
;script@"/~/at/lib/js/urb.js";
|
||||
==
|
||||
;body
|
||||
;*
|
||||
?~ authcode
|
||||
:_ ~
|
||||
;div: Something went wrong. Please try to auth again.
|
||||
;=
|
||||
;script: authcode = {(pojo %s authcode)}
|
||||
;script:'''
|
||||
if (authcode)
|
||||
urb.send({
|
||||
appl: "bit",
|
||||
data: authcode,
|
||||
mark: "oauth2-code"
|
||||
}, function(){
|
||||
})
|
||||
'''
|
||||
;div: 'Success. Your auth-token has been sent to your app. You can close this now.'
|
||||
==
|
||||
==
|
||||
==
|
@ -1,30 +0,0 @@
|
||||
::
|
||||
::::
|
||||
:::
|
||||
/? 310
|
||||
/= gas /$ fuel
|
||||
::
|
||||
::::
|
||||
::
|
||||
!:
|
||||
^- manx
|
||||
=+ do=(~(get by qix.gas) %'code')
|
||||
|
||||
;html
|
||||
;head
|
||||
;script@"/~/at/lib/js/urb.js";
|
||||
;script: urb.appl = 'cloud'
|
||||
;script@"https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js";
|
||||
;script@"https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js";
|
||||
::;link/"cloud/main.css"(rel "stylesheet");
|
||||
;title: DO & GCE Manager
|
||||
==
|
||||
;body
|
||||
;script:"""
|
||||
var authcode = \{}
|
||||
authcode.do='{?~(do ~ (trip u.do))}'
|
||||
"""
|
||||
;div#container;
|
||||
;script@"cloud/main.js";
|
||||
==
|
||||
==
|
@ -1,207 +0,0 @@
|
||||
recl = React.createClass
|
||||
div = React.DOM.div
|
||||
a = React.DOM.a
|
||||
b = React.DOM.button
|
||||
hr = React.DOM.hr
|
||||
table = React.DOM.table
|
||||
th = React.DOM.th
|
||||
tr = React.DOM.tr
|
||||
td = React.DOM.td
|
||||
input = React.DOM.input
|
||||
|
||||
function HashToJSON() {
|
||||
var pairs = window.location.hash.slice(1).split('&');
|
||||
var result = {};
|
||||
pairs.forEach(function(pair) {
|
||||
pair = pair.split('=');
|
||||
result[pair[0]] = decodeURIComponent(pair[1] || '');
|
||||
});
|
||||
|
||||
return JSON.parse(JSON.stringify(result));
|
||||
}
|
||||
|
||||
|
||||
DOControls = React.createClass({
|
||||
createDroplet: function(){
|
||||
urb.send({appl: "cloud",
|
||||
mark: "json",
|
||||
data: {'create-do':{
|
||||
name:$('#name').val(),
|
||||
region:$('#region').val(),
|
||||
size:$('#size').val(),
|
||||
image:$('#image').val(),
|
||||
ssh:[], // $('#ssh').val()]
|
||||
backups:null,//$('#backups').val(),
|
||||
ipv6:null,//$('#ipv6').val(),
|
||||
priv_networking:null,//$('#priv-networking').val(),
|
||||
user_data:null//$('#user-data').val()
|
||||
}}})
|
||||
},
|
||||
|
||||
render: function(){
|
||||
href = "https://cloud.digitalocean.com/v1/oauth/authorize?client_id=d8f46b95af38c1ab3d78ad34c2157a6959c23eb0eb5d8e393f650f08e6a75c6f&redirect_uri=http%3A%2F%2Flocalhost%3A8443%2Fhome%2Fpub%2Fcloud%2Ffab&response_type=code&scope=read+write"
|
||||
return (
|
||||
div({}, [
|
||||
div({},
|
||||
a({href:href},"get authcode"),
|
||||
b({onClick:this.props.handleClick('do')}, "Send Authcode")
|
||||
),
|
||||
div({}, [
|
||||
input({id:"appsecret"},
|
||||
b({onClick:this.props.sendSecret('do','#appsecret')}, "Send Secret"))
|
||||
]),
|
||||
|
||||
div({}, [
|
||||
b({onClick:this.createDroplet}, "Create Droplet"),
|
||||
input({id:"name",placeholder:"Name of droplet"}),
|
||||
input({id:"region",placeholder:"Region"}),
|
||||
input({id:"size",placeholder:"Size (str ending in mb"}),
|
||||
input({id:"image",placeholder:"Image"}),
|
||||
input({id:"ssh",placeholder:"ssh keys (optional)"}),
|
||||
input({id:"backups",placeholder:"backups (optional)"}),
|
||||
input({id:"ipv6",placeholder:"ipv6 (boolean, optional)"}),
|
||||
input({id:"user-data",placeholder:" user-data string (optional)"}),
|
||||
input({id:"priv-networking",placeholder:"Private Networking (boolean, optional)"})
|
||||
])
|
||||
])
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
GCEControls = React.createClass({
|
||||
createDroplet: function(){
|
||||
urb.send({
|
||||
appl: 'cloud',
|
||||
mark: 'json',
|
||||
data: {'create-gce':{
|
||||
// project:$('#project').val(),
|
||||
// zone:$('#zone').val(),
|
||||
// name:$('#gname').val(),
|
||||
// machine_type:$('#machine_type').val() /
|
||||
}}})
|
||||
},
|
||||
|
||||
createDisk: function(){
|
||||
urb.send({
|
||||
appl: 'cloud',
|
||||
mark: 'json',
|
||||
data: {'create-gce':{
|
||||
snap:$('#gsnap').val(),
|
||||
number:parseInt($('#number').val()),
|
||||
name:$('#gcpName').val(),
|
||||
instance_img:$('#instance_image').val()
|
||||
}}})
|
||||
},
|
||||
|
||||
render: function(){
|
||||
ghref = "https://accounts.google.com/o/oauth2/auth?response_type=token&scope=https://www.googleapis.com/auth/compute&redirect_uri=http://localhost:8443/cloud/fab&client_id=719712694742-6htfj2t9s1j2jid92rc4dfq9psrr9qpo.apps.googleusercontent.com"
|
||||
return(
|
||||
div({}, [
|
||||
div({}, [
|
||||
b({onClick:this.createDisk}, 'Create Disk From Image'),
|
||||
input({id:'gcpName',placeholder:'Name for GCE Disk and Instance'}),
|
||||
input({id:'number',placeholder:'Number of instances'}),
|
||||
input({id:'gsnap',placeholder:'Snapshot'}),
|
||||
input({id:'instance_image',placeholder:'Instance Image'})
|
||||
]),
|
||||
div({}, [
|
||||
a({href:ghref},"Get Google Authcode"),
|
||||
b({onClick:this.props.handleClick('gce')}, "Send Google Authcode")
|
||||
]),
|
||||
div({}, [
|
||||
input({id:"gappsecret"},
|
||||
b({onClick:this.props.sendSecret('gce','#gappsecret')}, "Send Google Secret"))
|
||||
])
|
||||
])
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
Droplet = React.createClass({
|
||||
dropletAction: function(act){
|
||||
return function(){
|
||||
var action = {act:{}, id:this.props.id, name:this.props.name}
|
||||
switch(act){
|
||||
case "snapshot":
|
||||
action.act[act] = this.refs.snapname.getDOMNode().value
|
||||
break; default:
|
||||
action.act[act] = null
|
||||
}
|
||||
urb.send({appl: "cloud", data: {action:action}})}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var $this = this //local var, else it always points at second
|
||||
var acts = ["start","stop","reboot","delete"] //,"snapshot"]
|
||||
var buttons = [];
|
||||
var buttons = acts.map(function(act){ return b({onClick:$this.dropletAction(act).bind($this)}, act)})
|
||||
kay = Object.keys(this.props)
|
||||
kay = kay.filter(function(b){return b!="children"}) // XX individually adress props
|
||||
return div({},[
|
||||
buttons,
|
||||
//input({ref:'snapname',placeholder:'Name of Snapshot'}),
|
||||
table({},
|
||||
tr({},kay.map(function(k){return th({},k)})),
|
||||
tr({},kay.map(function(k){return td({},JSON.stringify($this.props[k]))}))),
|
||||
hr()])
|
||||
}
|
||||
})
|
||||
|
||||
Page = recl({
|
||||
handleClick: function(platform){
|
||||
return function(){
|
||||
console.log(platform);
|
||||
console.log(window.authcode.platform)
|
||||
if(window.authcode.length !== ''){
|
||||
urb.send({
|
||||
appl: "cloud",
|
||||
data: {authcode:authcode[platform],
|
||||
platform:platform},
|
||||
mark: "cloud-auth"})
|
||||
} else { console.log("nocode") }
|
||||
}
|
||||
},
|
||||
|
||||
sendSecret: function(platform,codeid){
|
||||
return function(){
|
||||
console.log(platform,codeid)
|
||||
secret= $(codeid).val()
|
||||
if(secret !== '') {
|
||||
urb.send({appl: "cloud",
|
||||
data: {secret:secret,
|
||||
platform:platform},
|
||||
mark: "cloud-secret"})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getList: function(){
|
||||
urb.send({appl: "cloud",
|
||||
data: {action:"list"},
|
||||
mark: "json"})
|
||||
},
|
||||
|
||||
|
||||
render: function(){
|
||||
var drops = [], imgs = []
|
||||
if(this.props.instances) drops = this.props.instances.map(Droplet)
|
||||
if(this.props.images) imgs = this.props.images.map(
|
||||
function(i){return div({},i.name)}
|
||||
)
|
||||
return (div({},
|
||||
DOControls({handleClick:this.handleClick,sendSecret:this.sendSecret}),
|
||||
GCEControls({handleClick:this.handleClick,sendSecret:this.sendSecret}),
|
||||
drops,
|
||||
imgs
|
||||
))
|
||||
}
|
||||
})
|
||||
|
||||
var hash = HashToJSON() //pull out hash of query string for gce authcode
|
||||
authcode.gce = hash.access_token
|
||||
|
||||
mounted = React.render(Page({droplets:[]}), $("#container")[0])
|
||||
urb.bind("/", function(err,d) {
|
||||
|
||||
mounted.setProps(d.data)
|
||||
return})
|
@ -1,40 +0,0 @@
|
||||
::
|
||||
::::
|
||||
::
|
||||
/? 314
|
||||
/= gas /$ fuel
|
||||
::
|
||||
:::: ~sivtyv-barnel
|
||||
::
|
||||
!:
|
||||
|
||||
^- manx
|
||||
|
||||
=+ :- authcode=<(fall (~(get by qix.gas) %'code') '')>
|
||||
auth-url="https://www.coinbase.com/oauth/authorize?". :: "concat" . "enate"
|
||||
"response_type=code".
|
||||
"&client_id=2e688dde3f7655e7c261313a286e69e7c61ec5502459408b7818c4c74c77bf45".
|
||||
"&redirect_uri=http://localhost:8444/gen/main/pub/fab/coin".
|
||||
"&scope=user+balance+buy+sell+send+transactions".
|
||||
"&meta[send_limit_amount]=1&meta[send_limit_curency]=BTC&meta[send_limit_period]=day"
|
||||
;html
|
||||
;head
|
||||
;title: Coinbase Auth
|
||||
;script@"/gop/hart.js";
|
||||
;script@"/gen/main/lib/js/urb.js";
|
||||
;script@"https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js";
|
||||
==
|
||||
;body
|
||||
;a/"{auth-url}": Authenticate
|
||||
;script: authcode = {authcode}
|
||||
;div#changes;
|
||||
;script:'''
|
||||
if (authcode)
|
||||
urb.send({
|
||||
appl: "coin",
|
||||
data: authcode,
|
||||
mark: "oauth2-code"
|
||||
})
|
||||
'''
|
||||
==
|
||||
==
|
@ -1,48 +0,0 @@
|
||||
:: :: ::
|
||||
:::: /hook/hymn/fab/oct3/pub/ ::::::
|
||||
:: :: ::
|
||||
^- manx
|
||||
;html
|
||||
;head
|
||||
;meta(charset "utf-8");
|
||||
;script
|
||||
=type "text/javascript"
|
||||
=src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"
|
||||
;
|
||||
==
|
||||
;script
|
||||
=type "text/javascript"
|
||||
=src "/~~/~/at/lib/js/urb.js"
|
||||
;
|
||||
==
|
||||
;link
|
||||
=type "text/css"
|
||||
=rel "stylesheet"
|
||||
=href "/lib/base.css"
|
||||
;
|
||||
==
|
||||
;link
|
||||
=type "text/css"
|
||||
=rel "stylesheet"
|
||||
=href "oct3/main.css"
|
||||
;
|
||||
==
|
||||
;title: :oct3
|
||||
==
|
||||
;body
|
||||
;div#what
|
||||
;div#x
|
||||
;div.ship;
|
||||
;div.as: ✕
|
||||
==
|
||||
;div#vs: vs
|
||||
;div#o
|
||||
;div.ship;
|
||||
;div.as: ◯
|
||||
==
|
||||
==
|
||||
;div#bord;
|
||||
;div#audi;
|
||||
;script(type "text/javascript", src "oct3/main.js");
|
||||
==
|
||||
==
|
@ -1,37 +0,0 @@
|
||||
#what,#bord,#audi { width:600px; text-align:center; position:absolute;
|
||||
left:50%; margin-left:-300px; }
|
||||
#what { height:36px; top:18px; }
|
||||
#bord { height:600px; position:absolute; top:111px; opacity:.3; }
|
||||
#audi { top:760px; }
|
||||
.turn #bord { opacity:1; }
|
||||
#message { position:absolute; left:0; top:0; width:100%; height:90px;
|
||||
line-height:90px; background-color:#000; color:#fff;
|
||||
text-align:center; }
|
||||
#message .ship { display:inline; }
|
||||
#what { font-family:"bau"; }
|
||||
#what div { display:inline-block; }
|
||||
.ship { padding:.3rem; font-weight:400; letter-spacing:1px;
|
||||
text-transform:uppercase; line-height:2rem; }
|
||||
.ship:before { content:"~"; font-weight:500; font-size:1rem; }
|
||||
.waiting.ship:before { content:"Waiting"; color:#ccc; }
|
||||
#what #x,#what #o { border:2px solid #fff; }
|
||||
.x #what #x,.o #what #o { border:2px solid red; }
|
||||
#what #ship,#what #user { padding:.6rem; }
|
||||
#what .as { width:1.6rem; }
|
||||
#audi h1,#vs { margin:0 1rem; padding:.3rem; color:#fff;
|
||||
background-color:#000; }
|
||||
#audi h1 { font-size:.9rem; text-transform:uppercase;
|
||||
display:inline-block; background-color:#ccc; }
|
||||
#audi h1:after { content:""; margin:0; }
|
||||
#audi .ship { color:#ccc; }
|
||||
.spac { font-size:100px; line-height:200px; }
|
||||
.spac { width:198px; height:198px; border:1px solid #000;
|
||||
text-align:center; float:left; cursor:pointer; }
|
||||
.spac[data-index="0-0"],.spac[data-index="1-0"],.spac[data-index="2-0"]
|
||||
{ border-left:0; }
|
||||
.spac[data-index="0-0"],.spac[data-index="0-1"],.spac[data-index="0-2"]
|
||||
{ border-top:0; }
|
||||
.spac[data-index="2-0"],.spac[data-index="2-1"],.spac[data-index="2-2"]
|
||||
{ border-bottom:0; }
|
||||
.spac[data-index="0-2"],.spac[data-index="1-2"],.spac[data-index="2-2"]
|
||||
{ border-right:0; }
|
@ -1,89 +0,0 @@
|
||||
$(function() {
|
||||
$bord = $('#bord')
|
||||
$audi = $('#audi')
|
||||
$whom = $('#whom')
|
||||
|
||||
lett = ["x","o"]
|
||||
symb = [" ","✕","◯"]
|
||||
drab = function(state) {
|
||||
space = function(_state,y,x) {
|
||||
return "<div class='spac' data-index='"+y+"-"+x+
|
||||
"'>"+symb[_state]+"</div>"
|
||||
}
|
||||
s = ""
|
||||
x = 0
|
||||
y = 0
|
||||
for(i=0;i<9;i++) {
|
||||
j = [0,3,6,1,4,7,2,5,8][i] // XX math
|
||||
s += space((state.box[j] ? 1 : 0)+(state.boo[j] ? 2 : 0),y,x)
|
||||
x++
|
||||
if((i+1)%3 == 0) {
|
||||
y++
|
||||
x=0
|
||||
}
|
||||
}
|
||||
$bord.html(s)
|
||||
}
|
||||
|
||||
audi = function(state) {
|
||||
a = "<h1>audience</h1>"
|
||||
for(i=0;i<state.aud.length;i++) {
|
||||
a += "<div class='ship'>"+state.aud[i].slice(1)+"</div>"
|
||||
}
|
||||
$audi.html(a)
|
||||
}
|
||||
|
||||
who = null
|
||||
turn = function(state) {
|
||||
if(state.plx.slice(1) == window.urb.user)
|
||||
who = "x"
|
||||
if(state.plo.slice(1) == window.urb.user)
|
||||
who = "o"
|
||||
if(who == null && (state.plx == "" || state.plo == ""))
|
||||
wurn = true
|
||||
else
|
||||
wurn = (state.who == who)
|
||||
$('body').toggleClass('turn',wurn)
|
||||
$('body').toggleClass('x',(state.who == 'x'))
|
||||
$('body').toggleClass('o',(state.who == 'o'))
|
||||
}
|
||||
|
||||
assign = function(state) {
|
||||
if(!state.plo)
|
||||
state.plo = ""
|
||||
if(!state.plx)
|
||||
state.plx = ""
|
||||
$('#o .ship').toggleClass('anyone', (state.plo=="")).
|
||||
text(state.plo.slice(1))
|
||||
$('#x .ship').toggleClass('anyone', (state.plx=="")).
|
||||
text(state.plx.slice(1))
|
||||
}
|
||||
|
||||
message = function(mess) {
|
||||
mess = mess.split('"')[1]
|
||||
mess = mess.split("=")
|
||||
mess = "<div class='ship'>"+mess[0].slice(1) +
|
||||
"</div> ["+symb[lett.indexOf(mess[1].toLowerCase())+1]+"] WINS"
|
||||
$('body').append('<div id="message">'+mess+'</div>')
|
||||
setTimeout(function() { $('#message').fadeOut().remove(); }, 2000)
|
||||
}
|
||||
|
||||
urb.appl = 'oct3'
|
||||
urb.bind('/oct3', function(err,res) {
|
||||
if(typeof(res.data) == 'string')
|
||||
return message(res.data)
|
||||
assign(res.data)
|
||||
drab(res.data)
|
||||
audi(res.data)
|
||||
turn(res.data)
|
||||
})
|
||||
|
||||
$bord.on('click', function(e) {
|
||||
if(!$('body').hasClass('turn')) { return false }
|
||||
$t = $(e.target).closest('.spac')
|
||||
data = $.map(
|
||||
$t.attr('data-index').split('-'),
|
||||
function(i) { return Number(i); })
|
||||
urb.send({mark:'oct3-move',data:data})
|
||||
})
|
||||
})
|
@ -1,44 +0,0 @@
|
||||
/= all /; flop /^ (list (pair time ,*)) /@ /mime/
|
||||
;html
|
||||
;head:title:"Pastebin"
|
||||
;body
|
||||
;link(rel "stylesheet", href "/lib/base.css");
|
||||
;link(rel "stylesheet", href "paste/main.css");
|
||||
;script@"//code.jquery.com/jquery-2.1.4.min.js";
|
||||
;script@"/~/as/own/~/at/lib/js/urb.js";
|
||||
;script:'''
|
||||
document.title = 'pastebin - urbit'
|
||||
urb.appl = 'hood'
|
||||
urb.send.mark = 'write-paste'
|
||||
submit = function(){
|
||||
if($("select :selected").attr('value')===undefined) {
|
||||
$("select").addClass('err')
|
||||
return false
|
||||
}
|
||||
$("select").removeClass('err')
|
||||
$("textarea,button").attr('disabled', true)
|
||||
urb.send({
|
||||
txt:$("textarea").val(),
|
||||
typ:$("select :selected").val()
|
||||
}, function(){
|
||||
$.getJSON('paste.paste-new',null,function(resp){
|
||||
if(!resp) throw "No paste"
|
||||
window.location = "paste/"+resp.u
|
||||
})})
|
||||
}
|
||||
'''
|
||||
::
|
||||
;h1: New
|
||||
;p:textarea;
|
||||
;select
|
||||
;option(): Type
|
||||
;option(value "md"): Markdown
|
||||
;option(value "txt"): Text
|
||||
;option(value "hoon"): Hoon
|
||||
==
|
||||
;button(onclick "submit()"):"Submit"
|
||||
;hr;
|
||||
;h1: Recent
|
||||
;* (turn all |=([a=time *] ;p:a/"paste/{<a>}":"{<a>}"))
|
||||
==
|
||||
==
|
@ -1,42 +0,0 @@
|
||||
body {
|
||||
font-family: 'bau';
|
||||
margin: 4rem;
|
||||
width: 48rem;
|
||||
}
|
||||
|
||||
hr {
|
||||
width: 8rem;
|
||||
height: .2rem;
|
||||
background-color: #ccc;
|
||||
margin: 3rem 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
button,
|
||||
textarea {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
min-height: 12rem;
|
||||
border: 0;
|
||||
background-color: #eaeaea;
|
||||
}
|
||||
|
||||
select {
|
||||
border: 3px solid transparent;
|
||||
}
|
||||
|
||||
.err {
|
||||
border: 3px solid red;
|
||||
}
|
||||
|
||||
a {
|
||||
font-family: 'scp';
|
||||
color: inherit;
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau.woff");
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau-italic.woff");
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau-medium.woff");
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau-mediumitalic.woff");
|
||||
font-weight: 500;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau-bold.woff");
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau-bolditalic.woff");
|
||||
font-weight: 600;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau-super.woff");
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "bau";
|
||||
src: url("//storage.googleapis.com/urbit-extra/bau-superitalic.woff");
|
||||
font-weight: 600;
|
||||
font-style: italic;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "scp";
|
||||
src: url("//storage.googleapis.com/urbit-extra/scp-extralight.woff");
|
||||
font-weight: 200;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "scp";
|
||||
src: url("//storage.googleapis.com/urbit-extra/scp-light.woff");
|
||||
font-weight: 300;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "scp";
|
||||
src: url("//storage.googleapis.com/urbit-extra/scp-regular.woff");
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "scp";
|
||||
src: url("//storage.googleapis.com/urbit-extra/scp-medium.woff");
|
||||
font-weight: 500;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "scp";
|
||||
src: url("//storage.googleapis.com/urbit-extra/scp-bold.woff");
|
||||
font-weight: 600;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: "scp";
|
||||
src: url("//storage.googleapis.com/urbit-extra/scp-black.woff");
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
input,
|
||||
button,
|
||||
body {
|
||||
font-family: "bau";
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
pre,
|
||||
code,
|
||||
.mono {
|
||||
font-family:"scp";
|
||||
}
|
||||
|
||||
#c {
|
||||
width: 32rem;
|
||||
margin-left: -16rem;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
h1:after {
|
||||
content: "\2014";
|
||||
margin-left: 1rem;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
h2.advice {
|
||||
margin-top: 2rem;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
#c pre {
|
||||
font-size: .6rem;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
#pass {
|
||||
width: 32rem;
|
||||
}
|
||||
|
||||
button {
|
||||
border: .3rem solid #000;
|
||||
background-color: #fff;
|
||||
font-size: 1rem;
|
||||
padding: .3rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.sig {
|
||||
font-weight: 400;
|
||||
font-size: 2rem;
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
span#ship {
|
||||
font-family: 'bau';
|
||||
font-weight: 400;
|
||||
font-size: 1.2rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: .1rem;
|
||||
display: inline-block;
|
||||
min-width: 1rem;
|
||||
}
|
||||
|
||||
input {
|
||||
font-family: 'scp';
|
||||
display: inline;
|
||||
}
|
||||
|
||||
span#ship,
|
||||
input {
|
||||
border: none;
|
||||
padding: .3rem;
|
||||
outline: none;
|
||||
border-bottom: 3px solid #555;
|
||||
}
|
||||
|
||||
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
|
||||
#c {
|
||||
width: 16rem;
|
||||
margin-left: -8rem;
|
||||
}
|
||||
#pass {
|
||||
width: 16rem;
|
||||
}
|
||||
input {
|
||||
-webkit-appearance: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
170
web/match.hoon
170
web/match.hoon
@ -1,170 +0,0 @@
|
||||
:: Subtree match finder
|
||||
::
|
||||
:::: /hook/hymn/match
|
||||
::
|
||||
/= gas /$ fuel :: get request info
|
||||
/= src /: /%/ /hoon/ :: current source file
|
||||
::
|
||||
:::: ~sondel-forsut
|
||||
::
|
||||
|%
|
||||
++ conv $& [conv conv]
|
||||
[%0 @ub]
|
||||
::
|
||||
++ expr $| @tas
|
||||
(list expr)
|
||||
--
|
||||
::
|
||||
::::
|
||||
::
|
||||
=+ `nock`*conv :: extraneous typecheck
|
||||
|%
|
||||
++ build-from
|
||||
|= [hay=expr man=expr]
|
||||
=| axe=(list ?(%0 %1)) :: axis acummulator
|
||||
|- ^- (unit conv)
|
||||
?: =(man hay)
|
||||
[~ u=[%0 (join axe)]]
|
||||
?@ hay ~ :: fail if hay is atom
|
||||
=+ top=$(hay -.hay, axe [%0 axe])
|
||||
?^ top
|
||||
top :: cell is success
|
||||
=+ bot=$(hay +.hay, axe [%1 axe])
|
||||
?^ bot
|
||||
bot
|
||||
?@ man :: descend unless atom
|
||||
~
|
||||
=+ car=$(man -.man)
|
||||
?~ car
|
||||
~ :: lost head is failure
|
||||
=+ cdr=$(man +.man)
|
||||
?~ cdr
|
||||
~
|
||||
[~ u=[u.car u.cdr]]
|
||||
::
|
||||
++ join
|
||||
|= axe=(list ?(%0 %1))
|
||||
^- axis
|
||||
%+ reel axe |= [a=?(%0 %1) b=_1]
|
||||
(add a (lsh 0 1 b))
|
||||
::
|
||||
++ fetch :: (unit expr) by term
|
||||
;~ biff
|
||||
~(get by qix.gas) :: get from query string
|
||||
slay :: parse as coin
|
||||
|= con=coin
|
||||
^- (unit expr)
|
||||
?- -.con
|
||||
%$ :: single atom
|
||||
?. ?=(%tas p.p.con) ~
|
||||
[~ u=q.p.con] :: (some) if is term
|
||||
%blob :: noun literal, ignore
|
||||
~
|
||||
%many :: list of coin
|
||||
(zl:jo (turn p.con ..$)) :: when-for
|
||||
==
|
||||
==
|
||||
++ print |=(a=expr ~(ram re (rend a)))
|
||||
++ rend
|
||||
|= a=expr
|
||||
^- tank
|
||||
?~ a [%leaf "()"]
|
||||
?@ a [%leaf (trip a)]
|
||||
[%rose [" " "(" ")"] (turn `(list expr)`a ..$)]
|
||||
--
|
||||
!:
|
||||
::::
|
||||
::
|
||||
^- manx
|
||||
=+ hay=(fall (fetch %hay) %bad-expr)
|
||||
=+ man=(fall (fetch %man) %bad-expr)
|
||||
=+ res=(build-from hay man)
|
||||
;html
|
||||
;head
|
||||
;title: Match
|
||||
;* =- (turn `wall`- |=(a=tape ;script(type "text/javascript", src a);))
|
||||
:~ "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"
|
||||
"//cdnjs.cloudflare.com/ajax/libs/codemirror/4.3.0/codemirror.js"
|
||||
"/lib/syntax/hoon.js"
|
||||
==
|
||||
;link(rel "stylesheet", href "//cdnjs.cloudflare.com/ajax/libs/".
|
||||
"codemirror/4.3.0/codemirror.min.css");
|
||||
;style:'''
|
||||
.CodeMirror {
|
||||
height: 100%
|
||||
}
|
||||
.cm-s-default .cm-atom {color: #70f}
|
||||
.cm-s-default .cm-operator {color: #097}
|
||||
|
||||
#err {
|
||||
background: #fdd;
|
||||
display: none;
|
||||
}
|
||||
'''
|
||||
==
|
||||
;body
|
||||
;h3: Tree transform generator
|
||||
;p
|
||||
; Problem and solution found
|
||||
;a/"http://michaelblume.tumblr.com/post/97793328216": here
|
||||
==
|
||||
;pre
|
||||
; .= ';{input#man(onchange "change()", value (print man))}
|
||||
; .* ';{input#hay(onchange "change()", value (print hay))}
|
||||
;- ?~ res "!! :: no route"
|
||||
<u.res>
|
||||
==
|
||||
;p#err
|
||||
; Malformed expression: a-z and - in identifiers, whitespace, and
|
||||
; matched () are allowed
|
||||
==
|
||||
;script(type "text/ls") ;- %- trip
|
||||
'''
|
||||
encode = (exp)->
|
||||
pars = (lev, str)->
|
||||
| str is /^\s+/ => pars lev, str - /^\s+/
|
||||
| str is /^[a-z-]+/
|
||||
tail = pars lev, str - (term = /^[a-z-]+/)
|
||||
if tail => {tail, tail.rest, lev, atom: str.match term .0 }
|
||||
| str is /^\(/
|
||||
head = pars lev+1, str - /./
|
||||
if head?rest?
|
||||
tail = pars lev, head.rest
|
||||
if tail => {head, tail, tail.rest, lev}
|
||||
| str is /^\)/ and lev > 0 => {lev, rest: str - /./}
|
||||
| str is '' and lev is 0 => true
|
||||
| _ => null
|
||||
|
||||
esc = (lev)->
|
||||
unless lev > 1 => '_'
|
||||
else '~' * (2 ^ (lev - 2)) + '-'
|
||||
enc = (obj)->
|
||||
cab = esc obj?lev
|
||||
cabb = esc obj?lev + 1
|
||||
switch
|
||||
| !obj => ''
|
||||
| !obj.tail => cab
|
||||
| obj.atom => obj.atom + cab + enc obj.tail
|
||||
| obj.head => '.' + cabb + (enc obj.head) + cab + enc obj.tail
|
||||
|
||||
(enc pars 0 exp) - /__$/
|
||||
|
||||
@change = ->
|
||||
hav = (encode hay.value); mav = (encode man.value)
|
||||
if hav and mav
|
||||
$ err .slideUp!
|
||||
window.location =
|
||||
(window.location + '') - /\?.*/ + "?hay=#hav&man=#mav"
|
||||
else $ err .slideDown!
|
||||
'''
|
||||
==
|
||||
;script(src "//cdnjs.cloudflare.com/ajax/libs/".
|
||||
"livescript/1.2.0/livescript.min.js");
|
||||
:: ;button(onclick "$(err).slideUp()");
|
||||
;h3: Demo source
|
||||
;textarea#src: {(trip src)}
|
||||
;script:'''
|
||||
CodeMirror.fromTextArea(src, {lineNumbers:true, readOnly:true})
|
||||
'''
|
||||
==
|
||||
==
|
@ -1,6 +0,0 @@
|
||||
window.tree.components.talk = React.createClass({
|
||||
render: function() {
|
||||
return (React.DOM.div({}, "rendered."));
|
||||
}
|
||||
})
|
||||
|
@ -1,6 +0,0 @@
|
||||
;module(nav_title "Talk", nav_no-dpad "", nav_no-sibs "", nav_subnav "talk-station")
|
||||
;script@"/~~/~/at/lib/urb.js";
|
||||
;script@"/talk/main.js";
|
||||
;link/"/talk/main.css"(rel "stylesheet");
|
||||
;talk;
|
||||
==
|
@ -1 +0,0 @@
|
||||
<div><module js="/talk/main.js" css="/talk/main.css" component="talk"></module></div>
|
@ -1,50 +1,6 @@
|
||||
::
|
||||
::
|
||||
:::: /hook/hymn/fab/talk/pub/
|
||||
::
|
||||
/+ talk
|
||||
/= gas /$ fuel :: get request info
|
||||
=+ aut=?=(~ but.gas)
|
||||
=+ ^- man=span
|
||||
~| bad-path/but.gas
|
||||
%- need
|
||||
?+ but.gas ~
|
||||
[@ ~] ((sand %ta) i.but.gas)
|
||||
~ (some (main:talk (slav %p -:%)))
|
||||
==
|
||||
|%
|
||||
++ cdnj
|
||||
|= a=wall ^- marl
|
||||
%+ turn a
|
||||
|= lib=tape
|
||||
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/{lib}");
|
||||
--
|
||||
::
|
||||
::::
|
||||
::
|
||||
^- manx
|
||||
;html
|
||||
;head
|
||||
;meta(charset "utf-8");
|
||||
;* %- cdnj :~
|
||||
"jquery/2.1.1/jquery.js"
|
||||
"lodash.js/2.4.1/lodash.min.js"
|
||||
"react/0.13.1/react.js"
|
||||
==
|
||||
;script(type "text/javascript", src "{?:(aut "/~~" "")}/~/at/lib/js/urb.js");
|
||||
;meta(name "viewport", content "width=device-width, height=device-height, ".
|
||||
"initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0");
|
||||
;link(type "text/css", rel "stylesheet", href "/talk/main.css");
|
||||
;title: Talk
|
||||
==
|
||||
;body
|
||||
;div#c
|
||||
;div#station-container;
|
||||
;div#messages-container;
|
||||
;div#writing-container;
|
||||
;div#scrolling: BOTTOM
|
||||
==
|
||||
;script: window.talk = {(pojo (joba 'mainStation' s/man))}
|
||||
;script(type "text/javascript", src "/talk/main.js");
|
||||
==
|
||||
;module(nav_title "Talk", nav_no-dpad "", nav_no-sibs "", nav_subnav "talk-station")
|
||||
;script@"/~~/~/at/lib/urb.js";
|
||||
;script@"/talk/main.js";
|
||||
;link/"/talk/main.css"(rel "stylesheet");
|
||||
;talk;
|
||||
==
|
||||
|
@ -1,3 +0,0 @@
|
||||
~1970.1.1 Hello world
|
||||
~1970.1.2 Reordered for goo reason
|
||||
~1970.2.1 Hallo world?
|
@ -1,89 +0,0 @@
|
||||
:: Twig reprinter
|
||||
::
|
||||
:::: /hook/hymn/unparse/pub
|
||||
::
|
||||
/= gas /$ fuel
|
||||
/= src /: /%/mear /hoon/
|
||||
/= src2 /: /%/ /hoon/
|
||||
::
|
||||
:::: ~sondel-forsut
|
||||
::
|
||||
// /%/mear
|
||||
!:
|
||||
::::
|
||||
::
|
||||
=+ inp=`@t`(fall %.(%src ;~(biff ~(get by qix.gas) (slat %t))) '%no-source')
|
||||
^- manx
|
||||
;html
|
||||
;head
|
||||
;title:"Uneval"
|
||||
;style:'''
|
||||
#inp {
|
||||
height: 40%;
|
||||
width: 100%;
|
||||
font-family: Monospace;
|
||||
}
|
||||
'''
|
||||
==
|
||||
;body
|
||||
;h3: Abstract
|
||||
;p: Hoon linter, under construction.
|
||||
;h3: Input
|
||||
;textarea#inp(onchange "move()"):"{(trip inp)}"
|
||||
;h3: Twig (subset)
|
||||
;pre
|
||||
;* %- turn :_ |=(a=tape :/((weld a "\0a")))
|
||||
(wash 0^80 >(flag (ream inp))<)
|
||||
==
|
||||
;h3: Rectified output
|
||||
;pre: {(trip (mear (ream inp)))}
|
||||
;script:'''
|
||||
function move(){
|
||||
document.location = '?src=' + escp(inp.value)
|
||||
}
|
||||
function escp(s){
|
||||
acc = '~~'
|
||||
while(s.length){
|
||||
var cha = s[0];
|
||||
s = s.slice(1)
|
||||
switch(true){
|
||||
case /[a-z-]/.test(cha):
|
||||
acc += cha
|
||||
break;
|
||||
case cha === ' ':
|
||||
acc += '.'
|
||||
break;
|
||||
case /[.-]/.test(cha):
|
||||
acc += '~' + cha
|
||||
break;
|
||||
default:
|
||||
acc += '~' + cha.charCodeAt(0).toString(16) + '.'
|
||||
} }
|
||||
return acc
|
||||
}
|
||||
'''
|
||||
:: includes
|
||||
;* =- (turn `wall`- |=(a=tape ;script(type "text/javascript", src a);))
|
||||
:~ "//cdnjs.cloudflare.com/ajax/libs/codemirror/4.3.0/codemirror.js"
|
||||
"/lib/syntax/hoon.js"
|
||||
==
|
||||
;link(rel "stylesheet", href "//cdnjs.cloudflare.com/ajax/libs/".
|
||||
"codemirror/4.3.0/codemirror.min.css");
|
||||
;style:'''
|
||||
.CodeMirror {height: 70%}
|
||||
.cm-s-default .cm-atom {color: #70f}
|
||||
.cm-s-default .cm-operator {color: #097}
|
||||
'''
|
||||
:: sources
|
||||
;h3: Demo source: algorithm
|
||||
;textarea#src: {(trip src)}
|
||||
;script:'''
|
||||
CodeMirror.fromTextArea(src, {lineNumbers:true, readOnly:true})
|
||||
'''
|
||||
;h3: Demo source: page
|
||||
;textarea#src2: {(trip src2)}
|
||||
;script:'''
|
||||
CodeMirror.fromTextArea(src2, {lineNumbers:true, readOnly:true})
|
||||
'''
|
||||
==
|
||||
==
|
@ -1,315 +0,0 @@
|
||||
!: =~
|
||||
|%
|
||||
++ twyg $& [p=twyg q=twyg]
|
||||
$%
|
||||
[%bccb p=tyle]
|
||||
[%bccm p=tyle]
|
||||
[%bctr p=tyle]
|
||||
[%brls p=tyle q=twyg]
|
||||
[%brtr p=tyle q=twyg]
|
||||
[%brts p=tyle q=twyg]
|
||||
[%brcn p=(map term ,[?(%ash %elm) twyg])]
|
||||
[%cltr p=tufk]
|
||||
[%clsg p=tufk]
|
||||
[%clhp p=twyg q=twyg]
|
||||
[%cncl p=twyg q=twyg]
|
||||
[%cnhp p=twyg q=tufk]
|
||||
[%cnzy p=term]
|
||||
[%dtzy p=dime]
|
||||
[%dtzz p=dime]
|
||||
[%ktts p=term q=twyg]
|
||||
[%smsm p=tyle q=twyg]
|
||||
[%smdq p=(list $|(@ [~ twyg]))]
|
||||
[%tsgr p=twyg q=twyg]
|
||||
[%tsls p=twyg q=twyg]
|
||||
[%tssg p=tufk]
|
||||
[%wtcl p=twyg q=twyg r=twyg]
|
||||
[%wtdt p=twyg q=twyg r=twyg]
|
||||
|
||||
[%clcb p=twyg q=twyg]
|
||||
[%cndt p=twyg q=twyg]
|
||||
[%dttr p=twyg q=twyg]
|
||||
[%dtts p=twyg q=twyg]
|
||||
[%ktdt p=twyg q=twyg]
|
||||
[%ktls p=twyg q=twyg]
|
||||
[%kthx p=twyg q=twyg]
|
||||
[%sgbr p=twyg q=twyg]
|
||||
[%sgcb p=twyg q=twyg]
|
||||
[%sgts p=twyg q=twyg]
|
||||
[%sgzp p=twyg q=twyg]
|
||||
[%tscn p=twyg q=twyg]
|
||||
[%tsfs p=twyg q=twyg]
|
||||
[%tsgl p=twyg q=twyg]
|
||||
[%tshp p=twyg q=twyg]
|
||||
[%wtgl p=twyg q=twyg]
|
||||
[%wtgr p=twyg q=twyg]
|
||||
[%zpcm p=twyg q=twyg]
|
||||
[%zpsm p=twyg q=twyg]
|
||||
|
||||
[%zpzp ~]
|
||||
==
|
||||
::
|
||||
++ tyle $& [p=tyle q=tyle]
|
||||
$% [%axil p=base]
|
||||
[%bark p=term q=tyle]
|
||||
[%fern p=(mist tyle)]
|
||||
[%leaf p=dime]
|
||||
==
|
||||
::
|
||||
++ tufk (list twyg)
|
||||
++ tamk $% [%leaf p=tape]
|
||||
[%lone n=rune p=tamk]
|
||||
[%pair n=rune p=tamk q=tamk]
|
||||
[%trel n=rune p=tamk q=tamk r=tamk]
|
||||
[%quad n=rune p=tamk q=tamk r=tamk s=tamk]
|
||||
[%many n=rune p=(list tamk)]
|
||||
==
|
||||
::
|
||||
++ rune term
|
||||
++ mist |*(a=_,* ,[i=a t=(list a)])
|
||||
--
|
||||
=+ ^= tex
|
||||
=+ ^= a
|
||||
%- ream
|
||||
'''
|
||||
|%
|
||||
++ ace (just ' ') :: spACE
|
||||
++ bar (just '|') :: vertical BAR
|
||||
++ bas (just '\\') :: Back Slash (escaped)
|
||||
++ buc (just '$') :: dollars BUCks
|
||||
++ cab (just '_') :: CABoose
|
||||
++ cen (just '%') :: perCENt
|
||||
++ col (just ':') :: COLon
|
||||
++ com (just ',') :: COMma
|
||||
++ doq (just '"') :: Double Quote
|
||||
++ dot (just '.') :: dot dot dot ...
|
||||
++ fas (just '/') :: Forward Slash
|
||||
++ gal (just '<') :: Greater Left
|
||||
++ gar (just '>') :: Greater Right
|
||||
++ hax (just '#') :: Hash
|
||||
++ kel (just '{') :: Curly Left
|
||||
++ ker (just '}') :: Curly Right
|
||||
++ ket (just '^') :: CareT
|
||||
++ lus (just '+') :: pLUS
|
||||
++ hep (just '-') :: HyPhen
|
||||
++ pel (just '(') :: Paren Left
|
||||
++ pam (just '&') :: AMPersand pampersand
|
||||
++ per (just ')') :: Paren Right
|
||||
++ pat (just '@') :: AT pat
|
||||
++ sel (just '[') :: Square Left
|
||||
++ sem (just ';') :: SEMicolon
|
||||
++ ser (just ']') :: Square Right
|
||||
++ sig (just '~') :: SIGnature squiggle
|
||||
++ soq (just '\'') :: Single Quote
|
||||
++ tar (just '*') :: sTAR
|
||||
++ tec (just '`') :: backTiCk
|
||||
++ tis (just '=') :: 'tis tis, it is
|
||||
++ wut (just '?') :: wut, what?
|
||||
++ zap (just '!') :: zap! bang! crash!!
|
||||
--
|
||||
'''
|
||||
=+ b=(~(tap by ;;((map ,@tas ,[@ @t ^ [@ @ p=@t] ~]) +.a)))
|
||||
%- ~(gas by *(map ,@tas ,@t))
|
||||
(turn b |=(_i.-.b [(rap 3 (cut 3 [0 1] p) (cut 3 [2 1] p) ~) p.q]))
|
||||
|%
|
||||
++ temt
|
||||
|= a=@tasG
|
||||
`tape`~[(~(got by tex) (cut 4 [0 1] a)) (~(got by tex) (cut 4 [1 1] a))]
|
||||
::
|
||||
++ mear
|
||||
|= a=twig
|
||||
^- @t
|
||||
%- role
|
||||
(turn `wall`~(rend ta (payg (flag a))) crip)
|
||||
::
|
||||
++ flat
|
||||
|= a=tile
|
||||
^- tyle
|
||||
?- -.a
|
||||
^ [$(a p.a) $(a q.a)]
|
||||
?(%axil %leaf) a
|
||||
%bark a(q $(a q.a))
|
||||
?(%bush %reed) fern/~[$(a p.a) $(a q.a)] :: XX a
|
||||
%fern a(p [$(a i.p.a) (turn t.p.a ..$)])
|
||||
?(%herb %weed %kelp) (tyle a) :: XX
|
||||
==
|
||||
::
|
||||
++ limb-to-cord
|
||||
|= b=limb ^- cord
|
||||
?@ b ?~(b '$' b)
|
||||
?- -.b
|
||||
%| (cat 3 (fil 3 p.b '^') q.b)
|
||||
%& ?: =(1 (mod 2 (met 0 p.b)))
|
||||
(rsh 3 1 $(p.b (lsh 0 1 p.b)))
|
||||
=+ (slag 1 (rip 1 p.b))
|
||||
?: =(~ -) '.'
|
||||
(rap 3 (turn - ~(got by (mo 0^'-<' 1^'->' 2^'+<' 3^'+>' ~))))
|
||||
==
|
||||
++ flag
|
||||
|= a=twig
|
||||
^- twyg
|
||||
?- -.a
|
||||
^
|
||||
[$(a p.a) $(a q.a)]
|
||||
%bczp
|
||||
?: ?=(%null p.a) [%dtzz %n ~]
|
||||
$(a ~(open ap a))
|
||||
?(%bccb %bccm %bctr)
|
||||
a(p (flat p.a))
|
||||
?(%brls %brtr %brts %smsm)
|
||||
a(p (flat p.a), q $(a q.a))
|
||||
%brcn
|
||||
=< a(p (~(run by p.a) .))
|
||||
|=(b=foot ?+(-.b !! ?(%ash %elm) b(p (flag p.b))))
|
||||
?(%clsg %cltr %tssg)
|
||||
a(p (turn p.a ..$))
|
||||
%cnts
|
||||
?^ q.a cnzy/'-lost-cnts-mods'
|
||||
?~ p.a !!
|
||||
?^ t.p.a cnzy/(cat 3 '-lost-wing-many.' (crip <p.a>))
|
||||
cnzy/(limb-to-cord i.p.a)
|
||||
%dtzz
|
||||
a(q (,@ q.a))
|
||||
%ktts
|
||||
a(p (term p.a), q $(a q.a))
|
||||
?(%tsls %tsgr %clhp %cncl)
|
||||
a(p $(a p.a), q $(a q.a))
|
||||
?(%clcb %cndt %dttr %dtts %ktdt %ktls %kthx %sgbr %sgcb %sgts)
|
||||
a(p $(a p.a), q $(a q.a))
|
||||
?(%sgzp %tscn %tsfs %tsgl %tshp %wtgl %wtgr %zpcm %zpsm)
|
||||
a(p $(a p.a), q $(a q.a))
|
||||
?(%wtcl %wtdt)
|
||||
a(p $(a p.a), q $(a q.a), r $(a r.a))
|
||||
%smdq
|
||||
a(p (turn p.a |=(b=beer ?@(b b [~ ^$(a p.b)]))))
|
||||
@
|
||||
=+ b=(twyg a)
|
||||
?: =(a b) b
|
||||
=+ c=~(open ap a)
|
||||
::~& open/[a c]
|
||||
?. =(a c) $(a c)
|
||||
cnzy/(cat 3 '-lost-rune.' -.a)
|
||||
==
|
||||
::
|
||||
++ payl
|
||||
|= a=tyle
|
||||
^- tamk
|
||||
?- -.a
|
||||
^
|
||||
:+ %many %bccl
|
||||
|- ^- (list tamk)
|
||||
:- ^$(a p.a)
|
||||
?^ -.q.a $(a q.a)
|
||||
[^$(a q.a)]~
|
||||
%axil
|
||||
:- %leaf
|
||||
?- p.a
|
||||
[%atom @] ['@' (trip p.p.a)]
|
||||
%noun "*"
|
||||
%cell "^"
|
||||
%bean "?"
|
||||
%null "~"
|
||||
==
|
||||
%bark pair/[%bcts leaf/(trip p.a) $(a q.a)]
|
||||
%leaf leaf/(scow p.a)
|
||||
%fern many/[%bccl (turn `(list tyle)`p.a ..$)]
|
||||
==
|
||||
::
|
||||
++ back |=(a=tank `tamk`leaf/~(ram re a)) :: from old tank
|
||||
++ payg
|
||||
|= a=twyg
|
||||
^- tamk
|
||||
?- -.a
|
||||
^
|
||||
?. ?=($|(%clhp ^) -.q.a)
|
||||
pair/[%clhp $(a p.a) $(a q.a)]
|
||||
?@ -.q.a $(q.a +.q.a)
|
||||
?. ?=($|(%clhp ^) -.q.q.a)
|
||||
trel/[%clls $(a p.a) $(a p.q.a) $(a q.q.a)]
|
||||
?@ -.q.q.a $(q.q.a +.q.q.a)
|
||||
quad/[%clkt $(a p.a) $(a p.q.a) $(a p.q.q.a) $(a q.q.q.a)]
|
||||
::
|
||||
?(%bccb %bccm %bctr)
|
||||
lone/[-.a (payl p.a)]
|
||||
?(%brls %brtr %brts %smsm)
|
||||
pair/[-.a (payl p.a) $(a q.a)]
|
||||
%brcn
|
||||
many/[-.a (turn (~(tap by p.a)) paym)]
|
||||
?(%cltr %clsg %tssg)
|
||||
many/[-.a (turn p.a ..$)]
|
||||
%cnhp
|
||||
=+ tal=?:(?=([^ ~] q.a) i.q.a cltr/q.a)
|
||||
pair/[-.a $(a p.a) $(a tal)]
|
||||
%cnzy leaf/(trip p.a)
|
||||
%dtzy (back (sell [%atom p.p.a] q.p.a))
|
||||
%dtzz (back (sell [%cube q.p.a [%atom p.p.a]] q.p.a))
|
||||
%ktts pair/[-.a leaf/(trip p.a) $(a q.a)]
|
||||
%clhp $(a +.a)
|
||||
?(%tsls %tsgr %cncl)
|
||||
pair/[-.a $(a p.a) $(a q.a)]
|
||||
?(%clcb %cndt %dttr %dtts %ktdt %ktls %kthx %sgbr %sgcb %sgts)
|
||||
pair/[-.a $(a p.a) $(a q.a)]
|
||||
?(%sgzp %tscn %tsfs %tsgl %tshp %wtgl %wtgr %zpcm %zpsm)
|
||||
pair/[-.a $(a p.a) $(a q.a)]
|
||||
%smdq
|
||||
=< leaf/"\"{(zing (turn p.a .))}\""
|
||||
|= b=$|(@ [~ p=twyg]) ^- tape
|
||||
?@ b ~[b]
|
||||
?: ?=([%cltr ^ ~] p.b)
|
||||
$(p.b i.p.p.b)
|
||||
=+ c=^$(a p.b)
|
||||
?+ -.c "-rune-wide.{<`term`?^(-.p.b %cell -.p.b)>}"
|
||||
%leaf "\{{p.c}}"
|
||||
==
|
||||
?(%wtcl %wtdt)
|
||||
trel/[-.a $(a p.a) $(a q.a) $(a r.a)]
|
||||
%zpzp leaf/(temt -.a)
|
||||
==
|
||||
++ paym
|
||||
|= [a=term b=?(%ash %elm) c=twyg] ^- tamk
|
||||
:+ %pair ?-(b %ash %lsls, %elm %lshp)
|
||||
[leaf/(trip a) (payg c)]
|
||||
::
|
||||
++ ta
|
||||
=| [tab=@ edg=_80]
|
||||
|_ tam=tamk
|
||||
++ tmix
|
||||
|= [a=tape b=tape]
|
||||
`tape`(weld a (slag (lent a) b))
|
||||
::
|
||||
++ spac
|
||||
|=([a=@u b=tape] `tape`?~(a b [' ' $(a (dec a))]))
|
||||
::
|
||||
++ rend
|
||||
|-
|
||||
=- [i=(spac tab i) t=(turn t (cury spac tab))]
|
||||
^- (mist tape)
|
||||
?- -.tam
|
||||
%leaf
|
||||
[p.tam]~
|
||||
%lone
|
||||
=+ hed=$(tab 0, tam p.tam)
|
||||
?~ t.hed [(tmix (temt n.tam) (spac 4 i.hed))]~
|
||||
[(temt n.tam) hed]
|
||||
%pair
|
||||
=+ hed=$(tab 4, tam p.tam)
|
||||
[(tmix (temt n.tam) i.hed) (weld t.hed $(tab 0, tam q.tam))]
|
||||
%trel
|
||||
=+ hed=$(tab 4, tam p.tam)
|
||||
:- (tmix (temt n.tam) i.hed)
|
||||
:(weld t.hed $(tab 2, tam q.tam) $(tab 0, tam r.tam))
|
||||
%quad
|
||||
=+ hed=$(tab 6, tam p.tam)
|
||||
:- (tmix (temt n.tam) i.hed)
|
||||
:(weld t.hed $(tab 4, tam q.tam) $(tab 2, tam r.tam) $(tab 0, tam s.tam))
|
||||
%many
|
||||
=. tab 4
|
||||
?~ p.tam [(temt n.tam)]~
|
||||
=+ hed=$(tam i.p.tam)
|
||||
=+ tas=t.p.tam
|
||||
=+ tal=|-(`wall`?~(tas ["=="]~ (weld ^$(tam i.tas) $(tas t.tas))))
|
||||
[(tmix (temt n.tam) i.hed) (weld t.hed tal)]
|
||||
==
|
||||
--
|
||||
--
|
||||
==
|
Loading…
Reference in New Issue
Block a user