Skip to content

Instantly share code, notes, and snippets.

@echiesse
echiesse / StringPerformance.lua
Last active March 26, 2024 03:01
Performance benchmark for string replacement in lua
-- Functions based on this problem: http://rosalind.info/problems/revc/
complements =
{
A = "T",
T = "A",
C = "G",
G = "C",
}
@echiesse
echiesse / maybeMonad.lua
Last active June 20, 2023 07:41
Lua implementation of Maybe Monad.
-- The Maybe Monad:
local NOTHING = { val = nil }
maybe = {}
maybe.__index = maybe
-- Constructors:
maybe.just = function(val)
local obj = setmetatable({ val = val }, maybe)
@echiesse
echiesse / VSCodeConfig.md
Last active May 23, 2023 16:54
Guia de Configuração do VS Code

Guia de Configuração do VS Code

Temas Customizados

Temas são instalados como extenções em:

  • Linux: $HOME/.vscode/extensions
  • Windows: %HOME%\.vscode\extensions

User Snippets

@echiesse
echiesse / ecs_highlight.css
Created December 31, 2022 04:11
My Sphinx Syntax Highlight
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f8f8f8; }
.highlight .c { color: #0000ff; font-style: italic } /* Comment */
.highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */
.highlight .g { color: #000000 } /* Generic */
.highlight .k { color: #800000; font-weight: bold } /* Keyword */
.highlight .l { color: #000000 } /* Literal */
.highlight .n { color: #000000 } /* Name */
.highlight .o { color: #000080 } /* Operator */
.highlight .x { color: #000000 } /* Other */
@echiesse
echiesse / monkeyPatch.py
Created March 4, 2022 22:02
Example of altering a class in runtime
class A:
def p(self):
print("função A.p")
if __name__ == '__main__':
a = A()
a.p()
try:
a.f()
@echiesse
echiesse / vscode-light-theme.json
Last active November 24, 2021 21:18
My VS Code Light Theme
{
"name": "ECS Light",
"type": "light",
"colors": {
"activityBarBadge.background": "#007acc",
"editor.background": "#ffffff",
"editor.foreground": "#000000",
"editor.inactiveSelectionBackground": "#e5ebf1",
"editor.selectionHighlightBackground": "#add6ff80",
"editorIndentGuide.activeBackground": "#939393",
@echiesse
echiesse / activate.bat
Created September 20, 2021 20:24
Script para ativar python virtualenvs no windows. Tenta recursivamente até a raiz.
@echo off
set venvdir=%1
for /f "delims==" %%d in ('cd') do set currentDir=%%d
call :reset-el
if not "%venvdir%" == "" (
call %venvdir%\Scripts\activate
import subprocess
if __name__ == '__main__':
commands = b'''
a=5
b=7
c=a+b
print(c)
print("abacate")
'''
@echiesse
echiesse / InitByBuffer.cpp
Created December 28, 2019 18:46
Example of struct initialization via memcpy and using a union.
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
class Pair
{
public:
int x;
@echiesse
echiesse / jogoDaVelha.lua
Created October 18, 2017 18:44
Ajuda em um jogo da velha no LuaBR
board =
{
{1,2,3},
{4,5,6},
{7,8,9},
}
function play(piece)
local pos = tonumber(io.read())