Skip to content

Instantly share code, notes, and snippets.

@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 / sizeof_array.c
Last active May 15, 2019 23:06
C sizeof on vars, arrays and malloc
#include <stdio.h>
int main()
{
int a[5];
int b;
int* c = malloc(10 * sizeof(int));
printf("%i\n", sizeof(a));
printf("%i\n", sizeof(b));
@echiesse
echiesse / testLuaTableC_API.lua
Created March 15, 2019 03:47
Lua test script for creating a metatable from C API
print(getmetatable(A))
for i, v in pairs(A) do
print(i, v)
end
A.a = "banana"
A.subtable.a = "abacate"
print(A.a)
@echiesse
echiesse / lua_table_api_example.c
Created March 15, 2019 03:45
Setting a metatable inside a table from C API
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<lua.h>
#include<lualib.h>
#include<lauxlib.h>
int main()