If you didn’t like it, you can go back To where you whence were
Github won’t render the link above properly, gotta see the raw content
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "github.com/prometheus/prometheus/promql/parser" | |
| ) | |
| func main() { |
| // This is an extremely fun exercise and I could have probably | |
| // used something way simpler than this. But I love parsing <3 | |
| // For this lil calculator, I used a few mutually recursive | |
| // functions aided by two very simple operations (or, star). It | |
| // is an extremely simplified version of how Parsing Expression | |
| // Grammars (PEG) work. | |
| // Here's how it'd read in plain PEG | |
| // Expr <- _ Term |
| def download(url): | |
| "Use request to retrieve URL's content. It sleeps 1s before starting." | |
| time.sleep(3) # Can't bring the scraped site down :) | |
| return requests.get(url).text | |
| def saverequest(path, req): | |
| "Write `req' into file pointed by `path'. Assumes `req' is in UTF-8." | |
| io.open(path, 'w', encoding='utf-8').write(req) | |
| return req |
| #!/usr/bin/env python3 | |
| # Licensed under GPLv3: https://www.gnu.org/licenses/gpl.txt | |
| # Commit history available here: https://github.com/clarete/wheelbarrow/blob/master/lispinho/main.py | |
| # no dependencies, may also work with python2 | |
| from __future__ import print_function | |
| from pprint import pprint | |
| import enum | |
| import readline | |
| import sys |
| # Parse online cURL doc to generate binding definitions file | |
| import os | |
| import io | |
| import urlparse | |
| import re | |
| import lxml | |
| import lxml.html | |
| import requests |
| #include <vm.hpp> | |
| #include <bindgen.hpp> | |
| #include <curl/curl.h> | |
| static std::map<void*, oop> meme_mapping; | |
| static int prim_curl_global_cleanup (Process* proc) { |
| //sys #include <curl/curl.h> | |
| //sys typedef struct _ CURL | |
| //sys typedef int CURLcode | |
| //sys typedef int CURLoption | |
| //sys void curl_global_cleanup(void) | |
| //sys CURLcode curl_global_init(long flags) | |
| //sys CURL *curl_easy_init() | |
| //sys void curl_easy_cleanup(CURL *handle) | |
| //sys CURL *curl_easy_duphandle(CURL *handle) | |
| //sys char *curl_easy_escape(CURL *curl, const char *string, int length) |
| meme central:memescript/compiler; | |
| CURL_GLOBAL_SSL: (1<<0); | |
| CURL_GLOBAL_WIN32: (1<<1); | |
| CURL_GLOBAL_ALL: (CURL_GLOBAL_SSL | CURL_GLOBAL_WIN32); | |
| CURL_GLOBAL_NOTHING: 0; | |
| CURL_GLOBAL_DEFAULT: CURL_GLOBAL_ALL; | |
| CURL_GLOBAL_ACK_EINTR: (1<<2); | |
| class CURL |