Skip to content

Instantly share code, notes, and snippets.

@thrau
thrau / convert_assert.py
Last active June 14, 2022 04:02
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
@rougier
rougier / nano-minibuffer.el
Created March 25, 2022 09:54
Minibuffer frame for Nano Emacs
;; Nicolas .P Rougier emacs configuration - mini-frame configuration
;; ---------------------------------------------------------------------
(require 'vertico)
(require 'marginalia)
(require 'mini-frame)
(defun minibuffer-setup ()
;; This prevents the header line to spill over second line
(let ((inhibit-message t))
@svetlyak40wt
svetlyak40wt / ningle-uploader.lisp
Created February 11, 2022 16:36
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)
@monomon
monomon / simple-file-server.lisp
Created January 27, 2022 21:11
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"
@slapslash
slapslash / random_pypi.py
Last active January 20, 2022 11:43
Get a random selection from the top 5000 PyPI packages and show a short summary of them.
import random
import requests
# will be updated monthly.
top_url = "https://hugovk.github.io/top-pypi-packages/top-pypi-packages-30-days.min.json"
data = requests.get(top_url).json()
packs = [d["project"] for d in data["rows"]]
for _ in range(3):
(setq elfeed-feeds
'("http://feeds.feedburner.com/bact"
"https://kitty.in.th/index.php/feed/"
"https://www.unzeen.com/feed/"
"https://dev.to/feed/mrchoke"
"https://dev.to/feed/iporsut"
"http://thep.blogspot.com/feeds/posts/default"
"https://naiwaen.debuggingsoft.com/feed/"
"https://www.blognone.com/taxonomy/term/10564/feed"
"https://www.blognone.com/taxonomy/term/5345/feed"))
fn is_prime(comptime T: type,
n: T) bool {
var d: T = 2;
var exausted: bool = false;
var found: bool = false;
if (n < 0) return is_prime(-n);
if (n == 0 or n == 1) return false;
(define-module (gentst)
#:use-module (oop goops)
#:use-module (gentst1)
#:use-module (gentst2)
#:export (test)
#:re-export (foo)
#:duplicates (merge-generics))
@bastomiadi
bastomiadi / post-installation-void-linux-glibc.txt
Last active December 9, 2025 10:41
Post installation Void Linux (Glibc)
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
@eoranged
eoranged / main.py
Created September 27, 2021 10:30
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):