Tumgik
#drakma
angrygirlromero · 1 month
Text
OCEAN EYES PT. 4
Summary: In which the son of the God of thieves, is head over heels in love with the daughter of the sea God.
Warnings: possible grammar mistakes.
Pairing: Luke x daughter of Poseidon x Little brother Percy
------------------------------------------------------------
"Did you pack enough clothes?" "Yes ma'am" "Did you pack the first aid kit I left on your camping bag?" "Yes Ella-" "Did you-" "Take it easy princess I’m pretty sure Percy has everything he needs, I was there when he was packing" said Luke placing a comforting hand on Marella's lower back.
"I am only making sure, love" said the sea princess offering Pecy a soft smile as they stood by the border near Thalia's tree, "Well I am assuming Dionysus gave you your allowance" asked the older girl.
"Yeah he did, two hundred cash and a few drakmas?" said Percy with an unsure look, causing Annabeth to roll her eyes at his words, "They're called Golden Drachmas, get it right" said the Athena girl with an annoyed expression, erupting giggles from the couple before them as grover simply shook his head in disapproval.
"Don't be too hard on him Beth, remember to have patients, I ask you" said the daughter of Poseidon to the daughter of Athena, the younger girl nodded in agreement, "Please Grover watch over them, and bring them back alive" "Of course Ella, I promise"
-
Since the departure of the trio from Camp Ella had found herself feeling rather anxious, even the fish could sense it, she did not wish to pass her worry onto her beloved aquatic friends, but they too were worried about a war, about their homes and kingdom.
Marella found herself seated at the edge of dock once again this time the sun had already gone down, this was the place where she had first opened up to Percy about herself, the very day they had discovered that they were siblings, being close to the water always made Marella feel closer to her home, to her father.
Moving her feet in the deep fresh water Ella's eyes focused on the water her body soon stiffening at the sight of a glowing figure, a nereid, she sat at the bottom of lake staring up at the girl with eager eyes.
Ella wasted no time on pushing herself from the dock and into the water her body making instant contact with the water causing her senses to be awoken, by being in it's rightful place, water.
"State your business here" demanded the princess as she floated with her head held high a bright glowing tiara taking shape upon her head, Marella knew it was wrong for her to interact with nereid she was most likely sent by her father, and this interaction could get them both in big trouble.
"A message from you father, princess" said the woman calmly lowering her head in respect, "If your brother is not successfully with his quest by the time of summer solstice Zeus will officially declare war upon us, if that time comes your father wishes to have you at the ready to fight along side him in battle" said the Mythical woman.
"What of my brother?" asked Marella with a hard look in her sea blue eyes, "If he does not succeed what will happen to him?" asked the princess, "No harm shall come to your brother if he does not succeed, he shall be released from his quest and returned safely to camp" said the woman offering the princess a reassuring look.
"You on the other hand shall be returned to Atlantis" continued the woman, at her words Ella nodded in agreement, she would loose her place at camp her friends, Luke and Little Percy, but if that meant they would be safe Ella was willing to leave them all behind.
"I am aware, if that is all you are dismissed, I shall wish for your safe return home, tell my father that I am at the ready" said Marella not wasting another moment before making her way to the shore.
Marella made her way way out of the water calmly as her mind raced, she belonged here at camp, but her duty demanded her return home, "Ella?" called out a familiar voice, Marella's gaze snapped to Luke who stood by the shore, his lips parted in amazement at the sight of his girl, she was glowing in the water, and a tiara on her head, her form displaying a true ocean princess.
Ella took a few steps more finally coming out of the water to stand before Luke, Luke watched intently as the tiara before her head faded away into thin air as her glow soon decreased leaving just, Marella, his Ella.
"I- I was looking for you all over, you missed dinner, I took you a sandwich to your cabin but you weren't there so-" Luke stopped his rambling as Ella reached her hand up to his face, her soft fingers trailing over his rough scar, "You mean the world to me Luke" said Ella quietly, only loud enough for him to hear.
Luke's heart was beating out of his chest, his face flushed hot and red, as he let out unstable breaths, "I- I- y- you" the Hermes boy stuttered out, "you don't have to say anything my love" said Ella with a soft smile.
"My Love" her love, he was her love? she had never called him that before surely she called him only love, but Ella called even Clarisse love, despite the Ares girl's protests at the nickname, she called everyone love but never "My love", Luke could've died right there and then, he would pass a happy man for eternity.
Marella stared up into his dark brown eyes pure love and adoration evident in them, she bravely stood to the tips of her toes her arms snaking around his neck, and her hands tangling themselves into his soft curly hair, as she pressed her lips to his.
Luke froze for a mere second before he dipped down deepening the kiss, his hands arms wrapping themselves around her small waist, she bit his lip causing him to groan out, with a smile at her sneaky action.
This felt unreal, he had been dreaming of this moment since the moment he met her and finally it had become reality, he no longer felt as if he walked on the ground, fireworks seemed to be erupting inside him, she tasted of sea water and blueberries, just like he imagined she would.
Marella soon broke the kiss her eyes on Luke's as they both stood there breathlessly, "You have no idea how long ive been wanting to do that" breathed out the Hermes boy contently as he held his girl, "Believe me my love the feeling is very mutual" said Marella contently.
"I love you" Ella froze at Luke's words, she had not been expecting those words to come from his mouth, she was left startuck, “Luke, I-" "You don't have to say it back, at least not now, I just wanted you to know."
-
Two day had passed since since Ella and Luke had confessed their feelings for one another, two days since she had been informed what was to happen if Percy failed, and for the two days Marella had been contented, Luke had not left her alone not for a second, the Hermes boy unable to keep his wondering hand off of her.
The sea princess had not heard word from her brother, not since she had hear that he had a confrontation with Ares himself on the road, it was as if he had disappeared off the face of the earth since then.
But today was the day she would finally know her stance, Ella laid on the soft mattress of her bed her gaze focused on the ceiling of the room where wooden models of sea creatures hung from the ceiling, hand painted by Ella herself, her hands once more tangled in Luke's soft curls's.
Luke's head was resting in the crook of her neck his handsome face contoured into a peaceful expression as he slept, his steady breaths fanning Ella's neck and the sounds of soft snores welcomed themselves into her ears.
His strong arm's wrapped around her wait lovingly, holding onto her tightly as if he let go she’d disappear into thin air, certainly she would not, right? they were happy, for once despite Ella's rushing mind she had been happy the past days, sure her and Luke had broken the rules having him here but that did not matter.
They were both soon interrupted by the sound of loud trumpets blasting through the camp ground, because of course nothing so sweet and pure ever lasts, the loud sound jolting Luke awake, the Hermes boy quickly standing to his feet with ease, instantly reaching for the dagger that laid in his boots at the bed's feet.
"Be calm, my love" said Marella with a sad smile, his beautiful girl stood from the bed slipping on her slippers, Luke frowned as he watched his girl, why was she sad? what was that noise? he watched Marella make her way to the cabin door a stern look taking upon her beautiful face, no Luke did not like that look, he wanted to sooth the crease between her eyes brown away, he wanted to kiss her lips until they turned into her bright and beautfile smile, the same one that made his heart race.
Marella stopped at the door as if contemplating something in her head, but that only lasted a moment before she pushed the large doors open, she walked out, "Ella!" called Luke after her as he waisted no time in following her.
Luke watched as all the campers poured out of their cabins everyone rushing to Lake, the same direction Marella had rushed off to, Luke quickly jogged to the lake his eyes searching for her small figure in the group of teens.
He soon stopped as he reached the edge of the Lake where other couplers stood attempting to calm their kids, in the water stood a man, Poseidon, with him were several other men who looked unreal but they had tails, and weapons standing protectively in front of their God.
Luke's gaze soon found Ella in the crowd, Luke watching as the campers around her parted like a sea for her to pass, Poseidon held a proud look on his face as he watched his daughter emerge from the crowd, he dark curls held neatly in two braids framing her matured face beautifully.
Luke stepped forward as Ella began to take take small step into the water, had she known all this time? he asked himself how could she just leave him so easily? they had just found each other, and she was leaving him? to war to get herself killed by Zeus and Hades' monsters? Luke was selfish, yes this was her destiny, but couldn't allow it.
Luke rushed forward to her, grabbing at her hand softly, causing her eyes to snap back to him, her face softening for a second but soon retiring to it’s hard expression, "Don't do this ella, please" he pleaded, "You know better than anyone that I have no choice" she mumbled under her breath, her eyes pleading him to let her go, "No I finally got you after all this time and you're leaving me, you can't do this to me, princess" Luke said his voice breaking every so slightly.
Marella glanced back at her father who seemed to be glaring daggers at Luke, her father, her beloved father, who had taught her everything she knew, the god of the sea, he had raised her to be everything she was, now he asked a favor of her, she could not decline it, even if it would lead to her death.
Luke's head snapped to his side as he felt Mr. D's hand on his shoulder, "Let go kid" he muttered to the Hermes boy, "No- I-" "You have to let go Luke" said the god sternly.
Luke's gaze returning to Ella's he watched her eyes water, "Please" she said, Luke's heart broke, she didn't want this just as much as him, but it was her destiny, he remembered his own words "it's because your dad has bigger plans for Ella" he told Percy.
Luke let go, Ella's hand falling to her side as he stared at her with a longing gaze, "Come back to me, alive" he mumbled for her to hear, "I will" she said, before making her way to her father's side.
The entire camp held their berths as they watched a tiara take form on Marells's head, her PJ's turing into a deep blue gown fit for a princess, her true form.
Poseidon smiled slightly at his daughter, offering her his arm, which she gracefully took, Ella turned back her gaze meeting Luke's "I love you" she mouthed to him before she disappeared into the water with her father.
A tear slipped down Luke's cheek, the tear trailing down his scar, a heart broken look on his face, Marella had his heart and she had taken it with her, this wasn't her fault, his sweet Ella who loved the ocean more than anything, this was Percy's doing, Poseidon's doing, Zeus’ doing.
For this they would pay, Percy Jackson had failed and for his mistakes his beloved sister would pay the price, for his foolishness Percy Jackson would pay the price Luke promised himself.
Tag list:
@yummytootybutt 🎀 @mxtokko @poppyflower-22 @starryhiraeth @trashmouthsahra @purplerose291 @iloveneilperry @onlyreadz @mahidahi @stevenknightmarc @loveryoushouldcomeoverr @leopard-skin-pillbox-hat-ok @dracoslovergirl @pussyslayerhd @sparklybearcheesecake @moonz33 @skwangmbyul
A/N: So before anyone comes for me, here's chapter four, I am so sorry I completely forgot I even wrote this series for a spit second, but seeing the new Percy Jackson teaser brought back my inspiration, I do plan on continuing with this series because I love Marella sm, I can't let her go, if you wish to be apart of the tag list don't be shy message me or comment <333
16 notes · View notes
random-racehorses · 11 months
Text
Random Real Thoroughbred: HANKA
HANKA is a mare born in Peru in 1999. By BUGSY out of DRAKMA. Link to their pedigreequery page: https://www.pedigreequery.com/hanka
0 notes
klanceficatalogue · 4 years
Note
do you have any good bamf Klance or sports au’s?
ohh sure! - karri
bamf lance tag
bamf keith tag
sports au tag
The Real Enemy by Rennwolf (27/27 | 106,880 | Not Rated)
Keith is captured. It is unlikely anyone will come to his rescue and he is stuck in a cell. He must find the way out before it's too late. But wouldn't that be so much easier with a little help?Klance AU where Keith was raised by the Blade of Marmora and hasn't yet met the other Paladins.
//violence //torture //attempted sexual assault //possibly nsfw
star-crossed by realfakedoors (20/20 | 353,548 | Explicit)
They said, once upon a time, in a faraway land, there was a peaceful and prosperous kingdom, rich in romance and tradition. They said the Prince would host a ball, and choose his spouse, and they would live happily ever after.Well, they lied.
--
Keith is a Prince, and Lance lives with his shitty extended family. Neither of them are very happy, and when they meet, they're surprised to have so much in common. Strangers, to friends, and then, well...Meanwhile, Hunk is a sweetheart, Pidge is an iconic asexual, Shiro is a supportive Knight Dad™, Allura isn't here for anyone's crap, and there's some political shit going on that forces them all together.
//attempted sexual assault //nsfw //slavery //abuse 
(shadam, allura/romelle, hunk/shay)
Exotic by Redfox_Raine (9/9 | 30,872 | Mature)
The Castle of Lions stop by a planet named Drakma to form an alliance. The local Drakonians seem friendly enough, in fact they look very similar to humans (minus the sharp canines and bird legs). But what happens when the Drakonians make a request in return for making an alliance with Voltron? Their request: save a group of Drakonians who were enslaved by the Galra.
//nsfw
58 notes · View notes
nerdpiggy · 5 years
Text
dont tell me kimbley’s working with drakma
4 notes · View notes
4thesilkroad · 4 years
Text
Tumblr media
I heard the sound of passing planes - and I remembered the planes passing over the route of my apartment in Athens, that one of Erasmus days, near the sea and the old airport. The same road as Aleko Panagoulis.
My Irish roommate would swimming every night, until full November- and always said when back, how beautiful was the sensation of the plane passing over it on Glyfada's condominiums and the lights on the huge billboards of cigarettes -that have been there for years, now no more, with the lights on the sea and Piraeus lighting up.
One time I tried to swim there in November, in the afternoon and maybe there were 19 degrees outside but the water was really cold and I still remember the feeling of the heart that froze for a second. And that day in Imola was snowing and someone told us on the phone.
The degradeted beach, an ouzo to warm up, maybe 2, and even a Greek coffee-frape’.
The music, always patriotic, he said. And a warm pink sky in a day that ended up too early and pungent in all its nuances.
Running home with a ragged taxi and music at full blast and the road full of holes and sloping lanes before arriving in my popular neighborhood, where the Acropolis it sees as a mirage from a crumbling hill of modern ruins.
I made paintings in that house, in the middle of the small bedroom and the kitchen, there was always the smell of acrylics and varnish. But the sounds were all, the sound are all in the solitude, the noises, the dogs barking, the strong wind on the shutters, the skids of the motorbikes, the tinkling music always, the screams of the neighbors, street lovers, cat fights and the taxies horns. How many in Athens.
An incredible smokiness in the kafenions, nobody played cards, only a komboloy between the fingers to roll and still there was the drakma to pay for the wine of the tavern and cigarettes from the Pantopolio.
So, I suddenly thought of that November days at the beach, and a life of simple and dramatic things every day: A long-distance telephone call at the telephone booth, full of hope and love. An evening spent telling the dreams of life, the friendship between people who will never meet again. The impossible loves, the meaning of a life to be achieved, a walk hand in hand in a market of Babylonia.
Tumblr media
And everything as a book written in love letters, those, you do not know if they will arrive at their destination, if they are realized, in their fleetingness.
0 notes
readevalprint · 7 years
Text
Your personal DIY image search
Hi everyone, it’s been a while! I bet you forgot this blog even existed. I happen to be a big supporter of quality over quantity, so while my work on parsing Japanese counters earlier this year was pretty interesting, I already wrote way too many articles about Ichiran/ichi.moe so I decided to keep it to myself. Recently I’ve been working on a little side-project and now that it finally works, I think it deserves a full-fledged blog post.
For a bit of a nostalgia trip, let's go back to the early 00s. Remember when TinEye first appeared? It was amazing. For the first time you could easily find where that one image you once saved from some random phpBB forum is really from. It didn't matter if your image was resized, or slightly edited from the original, it still worked. That shit was magic, my friends. Of course these days nobody is impressed by this stuff. Google Image Search indexes pretty much anything that exists on the Internet and even uses neural networks to identify content of an image.
Back to the present day. I discovered I have an image hoarding problem. Over the years of using the Intertubes, I have accumulated a massive number of images on my hard drive. When I see an image I like my first thought is "do I have this one saved already?" because how could I possibly remember? At this point I need my own personal Google Image Search. And (spoiler alert) now I have one.
First of all, I needed an actual image matching technology. These days the cloud is all the rage, so I definitely wanted to have this thing running in the cloud (as opposed to my local PC) so that I could search my images from anywhere in the world. After a cursory search, my eyes fell on a thing called Pavlov Match which runs from a Docker container, so should be pretty easy to install. I installed docker and docker-compose on my VPS, and then git-cloned Match and ran make dev according to instructions. This will actually run an Elasticsearch instance on the same VPS, and apparently the damn thing eats memory for breakfast, at least with the default settings. I'm using a cheap 2GB RAM Linode, so the memory is actually a very finite resource here, as I will find out later. The default settings will also completely expose your match installation AND elasticsearch to the world. But don't worry, I figured this out so that you don't have to. Let's edit docker-compose.yml from match repository as follows:
version: '2' services: match: image: pavlov/match:latest ports: - 127.0.0.1:8888:8888 command: ["/wait-for-it.sh", "-t", "60", "elasticsearch:9200", "--", "gunicorn", "-b", "0.0.0.0:8888", "-w", "4", "--preload", "server:app"] links: - elasticsearch elasticsearch: image: elasticsearch environment: - "ES_JAVA_OPTS=-Xms256m -Xmx256m" - bootstrap.mlockall=true expose: - "9200"
This will make match server only available on local network within the VPS on port 8888, and elasticsearch only available to these two docker containers. It will also restrict elasticsearch RAM consumption to 512mb and --preload flag reduces the amount of memory gunicorn workers consume.
To make match server available from outside I recommend proxying it through nginx or some other proper web server. You can also add authentication/IP whitelist in nginx because the match server has no authentication features whatsoever, so anyone will be able to search/add/delete the data on it.
That was the backend part. No programming required here! But this is a Lisp blog, so the next step is writing a Lisp client that can communicate with this server. The first step is reading the match API documentation. You might notice it's a bit... idiosyncratic. I guess REST is out of fashion these days. Anyway, I started implementing a client using the trusty drakma, but I quickly hit a limitation: match expects all parameters to be sent encoded as form data, but drakma can only encode POST parameters as form data and not, say, DELETE parameters. Not to be foiled by a badly designed API, I tried dexador, and while dex:delete does not encode parameters as form data, dex:request is flexible enough to do so. Each response (a JSON string) is parsed using jsown.
(defun parse-request (&rest args) (when *auth* (setf args `(,@args :basic-auth ,*auth*))) (multiple-value-bind (content return-code) (handler-bind ((dex:http-request-failed #'dex:ignore-and-continue)) (apply 'dex:request args)) (cond ((<= 400 return-code 499) (jsown:new-js ("status" "fail") ("error" content) ("code" return-code))) (t (let ((obj (jsown:parse content))) (jsown:extend-js obj ("code" return-code))))))) (defun add-local (file &key path (metadata "{}")) "Add local image to Match server" (parse-request (api-url "/add") :method :post :content `(("image" . ,(pathname file)) ("filepath" . ,(or path file)) ("metadata" . ,metadata))))
With this basic client in place, I can add and delete individual images, but it would be incredibly cumbersome to manage thousands of images with it. I had to write some code that would scan specified directories for images, track any changes and then add/update/delete information from Match server as needed. I already wrote something like this before, so this was pretty easy. Of course SBCL's "sb-posix:stat doesn't work on Unicode filenames" bug has reared its head again, but I already knew the workaround. This time I completely relied on UIOP for recursively walking directories (uiop:subdirectories and uiop:directory-files are your friends). Each image file is represented as CLOS object and saved into a hash-table which is serialized to a file using CL-STORE. The object has a status attribute which can be :new, :update, :delete, :ok and so on. Based on status, an action needs to be performed, such as uploading an image to Match server (for :new and :update).
Now, I could just send a bunch of requests one after another, but that would be a waste. Remember, we have 4 gunicorn workers running on our server! This clearly calls for a thread pool. I thought PCALL would be perfect for this, but nope. It uses sb-thread:interrupt-thread which is incredibly unsafe and the result is that you basically can't safely make http requests from thread workers. Debugging this took way too much time. In the end, I implemented a thread pool based on lparallel promises which is kind of an overkill for such a simple use case, but at least it worked.
(setf *cache* (update-cache)) (let ((lparallel:*kernel* (lparallel:make-kernel threads))) (unwind-protect (loop for value in (alexandria:hash-table-values *cache*) collect (worker value) into futures finally (map nil 'lparallel:force futures)) (lparallel:end-kernel))) (save-cache *cache*))
Note that you must be very careful when doing things that affect global state inside the threads. For example :delete action removes a key from the hash table *cache*. This is not guaranteed to be an atomic operation, so it's necessary to grab a global lock when doing it.
(defvar *cache-lock* (bordeaux-threads:make-lock "match-cache-lock")) ... (bordeaux-threads:with-lock-held (*cache-lock*) (remhash key *cache*))
Printing messages to REPL from inside threads also requires a separate lock and (force-output), otherwise it will look like a complete mess!
(defun format-msg (str &rest args) (bordeaux-threads:with-lock-held (*msg-lock*) (terpri) (apply 'format t str args) (force-output)))
Now that the required functionality is implemented, it's time to test upload a bunch of stuff... and get back a bunch of errors. It took some sleuthing to discover that gunicorn workers of my Match server are routinely getting killed by "OOM killer". Basically, the server runs out of memory and the system in desperation kills a process that it doesn't like. Remember, I only have 2Gb of memory there!
I figured out that it's images with very large dimensions that are the most problematic in terms of memory usage. If I were to resize these images to some reasonable size, the matching should still work pretty well. In order to execute this plan, I thought I'd use some Lisp to ImageMagick interface. There's in fact a pure Lisp solution called OptiCL but would it really handle any image? Remind me to test that later! Anyway, back to ImageMagick. Neither lisp-magick nor lisp-magick-wand would work with the most recent ImageMagick version (seems its API has changed a bit). However the last one I tried cl-graphicsmagick, which uses a fork of ImageMagick called GraphicsMagick, has unexpectedly worked (at least on my Windows laptop. Note that you need to install Microsoft Visual C Redistributable 2008 otherwise the library wouldn't load with CFFI) so I went with that.
Using very useful temporary files functionality of UIOP (uiop:with-temporary-file), I resize each oversized image to reasonable dimensions and save into a temporary file, which is then uploaded to Match server. I also send the file's original and resized dimensions as metadata. Thankfully this completely eradicated the memory issue. There's a minor problem where GraphicsMagick cannot do Unicode pathnames on Windows, so I copy the original image into a temporary file with ASCII-only name in that case.
(defun resize-image (input-path output-path &key (max-width *max-dimension*) (max-height *max-dimension*) (filter :%QuadraticFilter) (blur 1)) (gm::with-magick-wand (wand) (handler-case (gm::%MagickReadImage wand input-path) ;; graphicsmagick cannot read Unicode filenames on Windows so attempt to load a copy (gm::magick-error () (uiop:with-temporary-file (:pathname tmp :prefix "gm" :type (pathname-type input-path)) (uiop:copy-file input-path tmp) (setf wand (gm::%NewMagickWand)) (gm::%MagickReadImage wand (namestring tmp))))) (let ((w (gm::%MagickGetImageWidth wand)) (h (gm::%MagickGetImageHeight wand)) (res nil)) (multiple-value-bind (fw fh) (gm::fit-width-height w h max-width max-height) (unless (and (= w fw) (= h fh)) (gm::%MagickResizeImage wand fw fh filter blur) (gm::%MagickWriteImage wand output-path) (setf res output-path)) (values res w h fw fh)))))
Later I tested this code on an Ubuntu machine with GraphicsMagick installed from Apt repository and SBCL crashed into ldb debugger mode straight away... Welp. The helpful folks of #lisp told me the problem is with signal handlers established by GraphicsMagick library, somehow they confuse SBCL. Based on that advice, eventually I succeeded making this work. Uninstall apt Graphicsmagick and grab the sources. Find the file called magick.c and replace the line
InitializeMagickSignalHandlers(); /* Signal handlers */
with
// InitializeMagickSignalHandlers(); /* Signal handlers */
(commenting it out). Then do configure --enable-shared (see readme for possible options), make and sudo make install. This will make it work when called from SBCL on Linux.
Anyways, the full code of MATCH-CLIENT can be found at my Github. It's not installable from quicklisp for obvious reasons, in fact it's a complete pain to install as you might've already guessed, but if you wanna try it, you're welcome. The main two commands are update and match. The first is called to upload all images in your *root-dirs* to the server and then to update them if anything changes. match is used to match any image on the Internet (passed as URL string) or a local pathname (passed as pathname object) compared to the server. It returns a list of jsown objects (basically alists) that contain score (up to 100 for exact match), path (with "local tag" which can be different per device) and metadata containing original and resized dimensions.
((:OBJ ("score" . 96.00956) ("filepath" . "[HOME] d:/foo/bar/baz.jpg") ("metadata" :OBJ ("rw" . 1218) ("rh" . 2048) ("w" . 3413) ("h" . 5736))))
Anyway, this was a fun (although often frustrating) thing to build and ended up being quite useful! Thanks for reading and see you next time.
3 notes · View notes
kaygun · 4 years
Text
Processing ECB Data with Common Lisp
Description of the problem
European Central Bank has a large economic data repository and lets people use it for free. It even has a nice API. I sometimes use their datasets as examples when I teach, especially when it comes to time series stuff.
Today, I am going to show how one can use their API from common lisp which is not very complicated, and one can translate the code to other languages in a fairly straight-forward manner.
The hard part
The data repository contains a large number of datasets. The good thing is that ECB allows bulk downloads of data. There is also a separate interface for data exploration, but that’s a topic for another post. Today, I am going to assume you know which dataset you want from ECB. Use their data exploration interface to find something that catches your fancy for the examples below.
The easy part
First, let us load all the libraries we need:
;; (mapcar #'ql:quickload '(:drakma :xmls :flexi-streams)) (mapcar #'require '(:drakma :xmls :flexi-streams))
(NIL NIL NIL)
Next, the threading macro from clojure that I like using. It is going to make the code more readable.
(defmacro ->> (x &rest forms)  (dolist (f forms x)    (if (listp f)        (setf x (append f (list x)))        (setf x (list f x)))))
->>
Here is another function that I like and going to use for this post from clojure:
(defun juxt (&rest fns)  (lambda (x)    (mapcar (lambda (f) (funcall f x)) fns)))
JUXT
Next, I need a piece of code that handles the requests for the ECB API.
(defun request (dataset)  (progn     (setf (aref dataset 3) #\/)     (->> dataset          (concatenate 'string "https://sdw-wsrest.ecb.europa.eu/service/data/ECB,")          drakma:http-request          flexi-streams:octets-to-string          xmls:parse)))
REQUEST
And the piece of code that extract the information as an association list:
(defun deep-get (tags xs)  (if (or (null xs) (null tags))      xs      (deep-get (cdr tags)                (let ((tag (car tags)))                  (mapcan (lambda (x) (xmls:xmlrep-find-child-tags tag x)) xs))))) (defun extract-data (dataset)  (->> dataset       request       list       (deep-get '("DataSet" "Series" "Obs"))       (mapcar (apply #'juxt                         (mapcar (lambda (tag)                                 (lambda (x) (->> (xmls:xmlrep-find-child-tag tag x)                                                  xmls:node-attrs                                                  cadar)))                     '("ObsDimension" "ObsValue"))))       (mapcar (lambda (x) (cons (car x)                                 (read-from-string (cadr x)))))))
DEEP-GET EXTRACT-DATA
Let us test: I am going to use data on Europe’s total trade (exports and imports) with Turkey. The keys for those datasets at ECB API are “TRD.M.I8.Y.X.TTT.TR.4.VAL” and “TRD.M.I8.Y.M.TTT.TR.4.VAL”
(defparameter turkey-export (extract-data "TRD.M.I8.Y.X.TTT.TR.4.VAL")) (defparameter turkey-import (extract-data "TRD.M.I8.Y.M.TTT.TR.4.VAL"))
TURKEY-EXPORT TURKEY-IMPORT
which then can be plotted
Tumblr media
0 notes
andreabujamra · 4 years
Video
instagram
24/4 drakma - Karnak https://www.instagram.com/p/B_BOv2mJL1R/?igshid=w3os6ja0qaqu
0 notes
Exotic
read it on the AO3 at http://archiveofourown.org/works/14072181
by Redfox_Raine
The Castle of Lions stop by a planet named Drakma to form an alliance. The local Drakonians seem friendly enough, in fact they look very similar to humans (minus the sharp canines and bird legs). But what happens when the Drakonians make a request in return for making an alliance with Voltron? Their request: save a group of Drakonians who were enslaved by the Galra.
Words: 3377, Chapters: 1/?, Language: English
Fandoms: Voltron: Legendary Defender
Rating: Mature
Warnings: Creator Chose Not To Use Archive Warnings
Categories: F/M, Gen, M/M
Characters: Lance (Voltron), Keith (Voltron), Shiro (Voltron), Pidge | Katie Holt, Hunk (Voltron), Allura (Voltron), Coran (Voltron)
Additional Tags: BAMF Lance (Voltron), Dancer Lance (Voltron), Captured Lance, Pining Lance (Voltron), Pining Keith (Voltron), Space Dad Shiro (Voltron), The Garrison Trio (Lance & Hunk & Pidge), Allura and Coran thinks of the team as family, Pidge sees Lance & Hunk as siblings, Alien Lance (Voltron), Lance is mistaken for an alien
read it on the AO3 at http://archiveofourown.org/works/14072181
0 notes
klanceficatalogue · 6 years
Note
hey yall! have you got any alien lance fanfic recs!! been lookin for some everywhere :-)
this was a surprisingly difficult request ngl sdjfh sorry if these arent up to your liking it was hard to find interesting-looking fics (plus i was trying to stay away from altean lance bc thats its own category) -alex
Under the Moonlight by Helpmelearntofly (1/3 | 1,619 | General)
Keith always looked up at the sky, hoping to find an answer that he knows he'll never find. The stars soothe him, the moon comforts him, the endless expansion of the universe consoles him. If only the world just beyond his reach could help him now.
Golden Thread by thatisnotokay (5/5 | 11,755 | Not Rated)
The Lions of Voltron are searching for their new Paladins. It was going fine until the Blue Lion gave Allura the name of an elusive, untrusting species that would be almost impossible to track down.
Exotic by Redfox_Raine (9/9 | 30,862 | Mature)
The Castle of Lions stop by a planet named Drakma to form an alliance. The local Drakonians seem friendly enough, in fact they look very similar to humans (minus the sharp canines and bird legs). But what happens when the Drakonians make a request in return for making an alliance with Voltron? Their request: save a group of Drakonians who were enslaved by the Galra.
85 notes · View notes
el-ismart · 10 years
Quote
Nuestras acciones definen el como seremos recordados
drakma 
1 note · View note
kaygun · 7 years
Text
Using Quandl with Common Lisp
Description of the problem
I do give quite a number of senior graduation projects on data analysis. For these projects my students need good reliable sources of data. I have used Quandl few times as a source of financial data, and I am quite happy about it. Its API has python and R bindings. But today, I am going to write a simple common lisp function to fetch data from Quandl.
Implementation
In order to fetch data from quandl, we are going to need an api-key. I am going to assume you already got an api-key from quandl. Once you get that, using the web API is quite simple.
For the purposes of this implementation, I am going to need a JSON decoder and an http-client.
(mapc #'require '(:drakma :cl-json))
(DRAKMA CL-JSON)
I am going to need a utility macro.
(defmacro ->> (x &rest forms)  (dolist (f forms x)    (if (listp f)        (setf x (append f (list x)))        (setf x (list f x)))))
->>
Next, the api call function:
(defun get-quandl (api-key data-set start end)  (->> (concatenate 'string                    "https://www.quandl.com/api/v3/datasets/"                    data-set                    ".json"                    "?api_key=" api-key                    "&start_date=" start                    "&end_date=" end)       drakma:http-request       octets-to-string       cl-json:decode-json-from-string       (assoc :dataset)       cdr))
GET-QUANDL
And here is a utility function that returns the selected portion of the data:
(defun get-column (data column)  (let ((n (position column                 (assoc :column--names data)                 :test #'string-equal)))    (mapcar (lambda (x) (elt x n))            (cdr (assoc :data data)))))
GET-COLUMN
I am going to calculate the correlation between EUR to CAD exchange rate to EUR to USD exchange rate. First let us get the data:
(defparameter CAD (get-quandl YOUR-API-KEY "ECB/EURCAD" "2016-01-01" "2016-12-31")) (defparameter USD (get-quandl YOUR-API-KEY "ECB/EURUSD" "2016-01-01" "2016-12-31"))
CAD USD
Let us define some basic statistics functions I need below:
(defun mean (data)  (->> (reduce #'+ data)       (* (/ (length data))))) (defun cov (xs ys)  (let* ((x (mean xs))         (y (mean ys)))     (mean (mapcar (lambda (u v) (* (- u x) (- v y))) xs ys)))) (defun std (xs)  (let ((x (mean xs)))    (sqrt (mean (mapcar (lambda (u) (* (- u x) (- u x))) xs))))) (defun cor (xs ys)  (/ (cov xs ys)     (* (std xs) (std ys))))
MEAN COV STD COR
and finally the correlation between EURCAD and EURUSD.
(cor (get-column CAD "Value") (get-column USD "Value"))
0.21443476
0 notes