Skip to content

Instantly share code, notes, and snippets.

View jgarte's full-sized avatar
🎯
Focusing

Jorge Gomez jgarte

🎯
Focusing
View GitHub Profile
@jgarte
jgarte / gist:6ba7a796365b348d35e23ad5c5f6178c
Created June 21, 2022 02:25 — forked from cky/gist:8500450
Guile implementation of Clojure's `#(...)` reader macro, but using `##(...)` instead to avoid conflicting with vectors.
(use-srfis '(1 69))
(read-hash-extend #\#
(lambda (c port)
(define ht (make-hash-table eqv?))
(define (ht-ref key)
(hash-table-ref ht key (lambda ()
(define sym (gensym))
(hash-table-set! ht key sym)
sym)))
(define (hash-key x)
@jgarte
jgarte / main.py
Created June 14, 2022 04:27 — forked from eoranged/main.py
LibCST example for Moscow Python Conf++ 2021
RESULTS = {}
def add_and_store(a, b, name):
"""Process and save to DB"""
result = a + b
RESULTS[name] = result
def add(a, b):
@jgarte
jgarte / convert_assert.py
Created June 14, 2022 04:02 — forked from thrau/convert_assert.py
script to covert unittest asserts to plain asserts
"""
Script to convert unittest asserts into plain asserts.
Either reads the file from the path passed as first parameter, or reads from stdin if no parameter is given.
"""
import functools
import sys
import libcst as cst
@jgarte
jgarte / libcst_transformer.py
Created June 14, 2022 03:56 — forked from sangwoo-joh/libcst_transformer.py
A rough example code for renaming variables using libcst.
import libcst
import difflib
from termcolor import colored
class RenameTransformer(libcst.CSTTransformer):
def __init__(self, rename_pairs):
self.rename_pairs = rename_pairs
self.restore_keywords = []
@jgarte
jgarte / move_thing.py
Created June 12, 2022 00:59 — forked from cowlicks/move_thing.py
python mover of things
def move_thing(src_mod, dest_mod, find_str):
import os
import rope.base.project
from rope.base import libutils
from rope.refactor import move
project = rope.base.project.Project(os.getcwd())
origin = libutils.path_to_resource(project, src_mod)
destination = libutils.path_to_resource(project, dest_mod)
@jgarte
jgarte / rope_rename.py
Created June 12, 2022 00:58 — forked from abingham/rope_rename.py
Basic programmatic use of rope
from rope.base import libutils
import rope.base.project
from rope.refactor.rename import Rename
project = rope.base.project.Project('.')
resource = libutils.path_to_resource(project, './sample.py')
renamer = Rename(project, resource, 81) # offset=81
changes = renamer.get_changes('Fnord')
project.do(changes)
@jgarte
jgarte / emacs_python_ide.md
Created March 30, 2022 00:34 — forked from widdowquinn/emacs_python_ide.md
Turning Emacs into a Python IDE

Turning emacs into a Python IDE

## Create a new config/initialisation file

Create a user-level initialisation file init.el:

touch .emacs.d/init.el
1. Update all package system
sudo xbps-install -Suv
2. add non-free repo
sudo xbps-install -Rs void-repo-nonfree
3. Software & utilities
sudo xbps-install -Rs xdg-desktop-portal xdg-desktop-portal-gtk xdg-user-dirs xdg-user-dirs-gtk xdg-utils vlc pipewire libspa-bluetooth noto-fonts-cjk noto-fonts-emoji noto-fonts-ttf noto-fonts-ttf-extra libreoffice-writer libreoffice-calc libreoffice-impress rhythmbox neofetch ntfs-3g gimp inkscape lm_sensors wget udisks2 gvfs mtpfs gvfs-mtp gvfs-gphoto2 xtools WoeUSB xz unrar qt5-wayland nano ffmpeg Kooha handbrake inxi streamlink
4. Install chrome gnome, gnome menu For Gnome & extension
@jgarte
jgarte / eternal_flame.sng
Created February 25, 2022 07:49 — forked from jimweirich/eternal_flame.sng
Words/Chords to the Eternal Flame
The Eternal Flame (God Wrote in Lisp)
Bob Kanefsky / Julia Ecklar
F G C
I was taught assembler in my second year of school.
F G C
It's kinda like construction work, with a toothpick for a tool.
F G C Em Am
So when I made my senior year, I threw my code away,
@jgarte
jgarte / package-local-nicknames.md
Created February 13, 2022 07:22 — forked from phoe/package-local-nicknames.md
Package-local nicknames in Common Lisp - a semishitpost about PLNs

Package-local nicknames in Common Lisp

Warning: this is a rant.

Warning: you have been warned.

Note: actually worthwhile content starts in the second subsection. You are free to skip the first one.

Story time