Skip to content

Instantly share code, notes, and snippets.

@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 May 30, 2024 09:14
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):
@somahargitai
somahargitai / goExecutableHowto.MD
Last active September 22, 2021 17:32
Make Go executable work on Mac

Make Go executable work on Mac

What we do

  • add necessary folder to Path
  • get the repo
  • create executable file with Make
  • copy executable to /usr/local/bin to let us it everwhere
  • modify access with chmod
@aiotter
aiotter / grep
Last active July 4, 2022 23:58
better grep (silently use ripgrep if available)
#!/usr/bin/env python3
# Copyright 2021 aiotter
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH T