Skip to content

Instantly share code, notes, and snippets.

@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

@jgarte
jgarte / ningle-uploader.lisp
Created February 11, 2022 16:58 — forked from svetlyak40wt/ningle-uploader.lisp
Example of a simple file uploader using Common Lisp and Ningle framework
;; License: MIT
(uiop:define-package #:ningle-upload
(:use #:cl)
(:import-from #:cl-fad)
(:import-from #:ningle)
(:import-from #:spinneret)
(:import-from #:log4cl))
(in-package #:ningle-upload)
@jgarte
jgarte / simple-file-server.lisp
Created January 27, 2022 21:22 — forked from monomon/simple-file-server.lisp
Simple hunchentoot server with file form and post handler for the file
(define-easy-handler (submission-form :uri "/" :default-request-type :get) ()
(setf (hunchentoot:content-type*) "text/html")
(with-html-output-to-string (s)
(:html
(:head
(:title "File Processor")
(:style :rel "stylesheet" :type "text/css"
(str (css-lite:css (("body") (:background-color "#666"))))))
(:body
(:form :action "/process"