This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun generate-tuples (n k) | |
(cond ((zerop n) `()) | |
((= n 1) `(,(list k))) | |
((zerop k) `(,(make-list n :initial-element 0))) | |
(t (loop for i from 0 upto k appending | |
(mapcar (lambda (a) (cons i a)) (generate-tuples (1- n) (- k i))))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; Experimenting with 3D rendering in McCLIM | |
(ql:quickload '(mcclim 3d-matrices 3d-vectors 3d-quaternions)) | |
(defpackage #:3d-test | |
(:use #:clim #:clime #:clim-lisp #:org.shirakumo.flare.quaternion | |
#:org.shirakumo.flare.matrix #:org.shirakumo.flare.vector)) | |
(in-package :3d-test) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name torn-treemap | |
// @version 8 | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js | |
// @require https://d3js.org/d3.v4.js | |
// @include https://www.torn.com/item.php | |
// @grant GM.setValue | |
// @grant GM.getValue | |
// @author selwyn [2093198] | |
// @description Plots a treemap of the user's inventory by total item market value on the items page. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar *example-tensor-list* '((p i) (q j) (i j k l) (r k) (s l))) | |
(defvar *example-tensor-goal* '(p q r s)) | |
(defclass tensor-contraction-node (micmac.uct:uct-node) | |
((tensor-list :accessor tensor-list | |
:initarg :tensor-list | |
:type list))) | |
(defclass tensor-contraction-edge (micmac.uct:uct-edge) |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clasp 4361 5281.261515: 1 cycles:ppp: | |
ffffffff9c05cba6 native_write_msr+0x6 ([kernel.kallsyms]) | |
ffffffff9c00c3b7 __intel_pmu_enable_all.constprop.22+0x47 ([kernel.kallsyms]) | |
ffffffff9c1aa0ba event_function+0x8a ([kernel.kallsyms]) | |
ffffffff9c1a3c0c remote_function+0x3c ([kernel.kallsyms]) | |
ffffffff9c113885 flush_smp_call_function_queue+0x35 ([kernel.kallsyms]) | |
ffffffff9c80239a smp_call_function_single_interrupt+0x3a ([kernel.kallsyms]) | |
ffffffff9c801aaf call_function_single_interrupt+0xf ([kernel.kallsyms]) | |
7f28b251c7c5 GC_malloc_kind+0x25 (/usr/local/lib/libgc.so.1.3.2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
lisp=$(1:sbcl) | |
port=$(2:4005) | |
$lisp --eval '(ql:quickload :swank)' \ | |
--eval \'(swank:create-server :port $port :dont-close t)\' \ | |
--eval '(sleep (expt 10 10))' \ | |
--non-interactive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; A guide I made which summarises the best way to do typical tasks in Common Lisp, using the easiest or most standard libraries out there. | |
;;; By 'typical' I mean tasks which are typically achieved using some standard library in Python, which in Lisp would require the use of Alexandria | |
;;; or some other such helper library which is not covered in the HyperSpec or introductory texts. May be useful to others. | |
;; Executing a shell task with real-time output (this is the best I could do, unfortunately SBCL specific and not Lispy. | |
;; Useful for long running tasks like builds which may take some hours to complete. | |
(sb-ext:run-program "/bin/bash" (list "-c" | |
"echo a && sleep 1 && echo b && sleep 2 && echo c") | |
:input t :output *standard-output*) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A highly customised .bashrc file with a coloured PS1 prompt. | |
# Cobbled together from various snippets around the internet. | |
# Selwyn Simsek | |
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# Customize BASH PS1 prompt to show current GIT repository and branch. | |
# by Mike Stewart - http://MediaDoneRight.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sets CUDA_VISIBLE_DEVICES to be the ID of the GPU with the most free memory, via text munging of nvidia-smi output. | |
# | |
# Usage: set-cvd.sh ./cudaexec sets CUDA_VISIBLE_DEVICES and runs cudaexec. | |
# | |
# | |
export CUDA_VISIBLE_DEVICES=$(nvidia-smi | grep % | awk '{print $9 }' | tr -d MiB | nl | sort -k2 -n | head -1 | awk '{print $1 -1}') | |
$* |