Skip to content

Instantly share code, notes, and snippets.

View aripiprazole's full-sized avatar
🎯
Focusing

Gabrielle Guimarães de Oliveira aripiprazole

🎯
Focusing
View GitHub Profile
@aripiprazole
aripiprazole / keybindings.json
Last active August 17, 2024 16:23
My mac visual studio code options
// Place your key bindings in this file to override the defaults
[
{
"key": "shift+k",
"command": "editor.action.showDefinitionPreviewHover",
"when": "editorTextFocus && vim.mode == 'Normal'"
},
{
"key": "ctrl+right",
"win": "ctrl+right",
@aripiprazole
aripiprazole / expr.rs
Created July 5, 2023 20:02
expr.rs a very cute file
/// Accessor expression, is an expression that is an accessor to a field in a struct, it can be
/// represented by [GlobalId], since it can hold `.` too.
///
/// # Examples
///
/// The syntax is like:
/// ```haskell
/// person.data
/// ```
#[derive(Default, Node, Clone)]
@aripiprazole
aripiprazole / lisp.rs
Created March 25, 2023 23:18
Simple Lisp in Rust
use std::{cell::RefCell, collections::HashMap, fmt::Display, rc::Rc};
// The `Expr` type is a type that represents a lisp S-expression.
// It can be either a `Nil` value, a `Cons` cell, a `Number, or an `Atom`.
#[derive(Clone)]
pub enum Expr {
Nil,
Cons(Rc<Expr>, Rc<Expr>),
Num(u64),
Str(String),
@aripiprazole
aripiprazole / lexing.rs
Last active August 22, 2022 11:38
Simple programming language
// Simple programming language
// Copyright (C) 2022 Gabrielle
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@aripiprazole
aripiprazole / json.main.kts
Last active August 22, 2022 11:34
Top-down JSON parser
sealed class Json {
data class Array(val items: Collection<Json>) : Json()
data class Object(val fields: Map<String, Json>) : Json()
data class Text(val text: String) : Json()
data class Numeric(val numeric: Double) : Json()
sealed class Bool(val bool: Boolean) : Json() {
object True : Bool(true) {
override fun toString(): String = "False"
}
@aripiprazole
aripiprazole / Google.py
Last active August 22, 2022 11:33
Migrating youtube playlist
import pickle
import os
from google_auth_oauthlib.flow import Flow, InstalledAppFlow
from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload, MediaIoBaseDownload
from google.auth.transport.requests import Request
def Create_Service(client_secret_file, api_name, api_version, *scopes):
print(client_secret_file, api_name, api_version, scopes, sep='-')
package ekko.tree
/**
* Types can be quantified by adding a list of predicates [predicates], to restrict
* the ways in which type variables is instantiated.
*
* Example of `Num a => a`(in haskell):
* ```kt
* val predicates = listOf(IsIn(TVar(Ident("a", KStar), Ident("Num"))))
*
package ekko.tree
/**
* Type schemes are used to describe qualified types.
* Each TGen that appears in [qual] represents a generic that the kind is given
* by `[kinds] !! n`.
*/
data class Scheme(val kinds: List<Kind>, val qual: Qual<Typ>) {
companion object {
fun forall(vararg args: Kind) = fun(qual: Qual<Typ>): Scheme {
@aripiprazole
aripiprazole / ast.rs
Last active August 22, 2022 11:30
Parser for a typed lox programming language
/*
* Rox is a simple object oriented language with non static typing
* Copyright (C) 2022 Gabrielle Guimarães de Oliveira
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
package ekko.typing
import ekko.tree.Alt
import ekko.tree.EAbs
import ekko.tree.EApp
import ekko.tree.EGroup
import ekko.tree.ELet
import ekko.tree.ELit
import ekko.tree.EVar
import ekko.tree.Exp