Skip to content

Instantly share code, notes, and snippets.

Goheeca

Block or report user

Report or block Goheeca

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pausable-thread.lisp
#!/usr/bin/sbcl --script
(load "~/.sbclrc")
(ql:quickload '("bordeaux-threads") :silent t)
(defun color-formatter (color)
(format nil "~a[~am~~?~a[m" #\Esc color #\Esc))
(defvar *output-lock* (bt:make-lock "OUTPUT LOCK"))
(defmacro safe-format (stream fmt &rest args)
@Goheeca
Goheeca / init.slime
Created Nov 17, 2019
Clean SLIME REPL
View init.slime
(ql:quickload "macroexpand-dammit")
@Goheeca
Goheeca / shared.lisp
Last active Nov 17, 2019
Multiprocess multithreaded computation with SBCL
View shared.lisp
#!/usr/bin/sbcl --script
(require :sb-posix)
(require :sb-bsd-sockets)
;;; Globals
;; IPC
(defvar *pid* nil)
(defvar *socket-path* "/tmp/socket")
(defvar *socket* nil)
;; MT
@Goheeca
Goheeca / braille-pixels.lisp
Last active Nov 17, 2019
Braille pixels images using cl-charms (@ SBCL)
View braille-pixels.lisp
#!/usr/bin/sbcl --script
#|
Usage
=====
$ ./braille-pixels.lisp [path]
Main
====
@Goheeca
Goheeca / ambiguous.pyjs
Last active Nov 17, 2019
Common Lisp ≡ ⊤
View ambiguous.pyjs
#||| Python or JS that is the question. |#
#|| Let's define a JS function, provided we're in JS. |#
#+moody-js"
function fact(n) {
if (n == 0) return 1
else return n * fact(n - 1)
}
"
@Goheeca
Goheeca / finite.py
Last active Mar 13, 2019
Shamir's Secret Sharing Scheme
View finite.py
from fractions import Fraction
import random
from itertools import zip_longest
class Field(object):
def __init__(self):
self.characteristic = None
def __call__(self, value):
@Goheeca
Goheeca / setpath.bat
Created Feb 20, 2015
Executor which is setting the path variable from the file for a command (for Windows)
View setpath.bat
@echo off
setlocal enabledelayedexpansion
set PATH=
if not "%~1" == "" (
for /f "Tokens=* Delims=" %%x in (%1) do (
if [!PATH!] == [] (
set PATH=!PATH!%%x
) else (
set PATH=!PATH!;%%x
@Goheeca
Goheeca / threads.lisp
Last active Nov 17, 2019
Bordeaux Threads test
View threads.lisp
(require :asdf)
(require :bordeaux-threads)
(defun color-formatter (color)
(format nil "~a[~am~~?~a[m" #\Esc color #\Esc)) ; The formatter function wants a simple-string.
(defun message (color i thread)
(let ((color-format (color-formatter color))
(thread-name (bt:thread-name thread)))
(format t "~&Hello for the ~? time from the ~? thread.~%"
View filter-for-danyk.js
// ==UserScript==
// @name Toggler based on nicknames
// @namespace GHC
// @version 0.2
// @description to get rid of bullshits and tldrs
// @match http://danyk.cz/kniha/kniha.php*
// @require http://code.jquery.com/jquery-2.1.0.min.js
// @require http://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.0/jquery.cookie.js
// @copyright 2014+, Goheeca
// ==/UserScript==
You can’t perform that action at this time.