Skip to content

Instantly share code, notes, and snippets.

import smokesignal
from helga.client import helga
from helga.extensions.base import CommandExtension, ContextualExtension
class MemoExtension(CommandExtension, ContextualExtension):
"""
Memos are very useful in IRC to leave a note for someone presently offline.
"""
NAME = 'memo'
@kingcons
kingcons / wheezy_fixup.sh
Last active December 23, 2015 00:38
Use sed on Fez settings to make it run Windowed.
#!/bin/sh
wget http://libsdl.org/release/SDL2-2.0.0.tar.gz
tar zxvf SDL2-2*tar.gz
cd SDL2-2.0.0
./configure && make -j 4
# You may need to change the path to fez for this to work
rm ~/fez/lib64/libSDL2-2.0.so.0
cp builds/.libs/libSDL2-2.0.so.0 ~/fez/lib64/
sed -i s/Fullscreen/Windowed/g ~/.config/FEZ/Settings
(defmacro count-macro-expansions (&body body)
"Count the number of macro expansions required to execute
BODY. Return two values: the result of executing BODY and the
number of expansions."
(let ((closures (gensym "CLOSURES-")))
`(let* ((,closures
(funcall
(compile nil
`(lambda ()
(let ((count 0))
;; Stolen from Read-Eval-Print-Love by the inimitable Michael Fogus
(defmacro schemish (functions &body body)
`(macrolet ,(mapcar (lambda (function)
`(,function (&rest args)
`(funcall ,',function ,@args)))
functions)
,@body))
@kingcons
kingcons / basics.lisp
Last active December 25, 2015 00:59
Now with more stuff!
(defpackage :cl-basics
;; Clauses we're not using: import-from, export, shadow
(:use :cl))
(in-package :cl-basics)
(defvar *foo* "bar"
"A simple variable with docstring.")
(defun foo (bar)
@kingcons
kingcons / oo.lisp
Last active December 25, 2015 01:09
tweaks
(defpackage :lisp-oo
(:use :cl))
(in-package :lisp-oo)
(defclass content ()
((tags :initform nil :initarg :tags :accessor content-tags)
(slug :initform nil :initarg :slug :accessor content-slug)
(date :initform nil :initarg :date :accessor content-date)
(text :initform nil :initarg :text :accessor content-text)))
@kingcons
kingcons / toy.js
Created November 12, 2014 03:22
JS Cons Trick
(function () {
var exports = {};
exports.makeArray = function (a, b) {
return function(chooser) {
return chooser(a, b);
};
};
exports.first = function (array) {
@kingcons
kingcons / gist:f8a0ed7d67e5e16a72a4
Created January 4, 2015 21:50
Install Party!!!

wifi password: Ir0nY@rd$*

You will want to run which command for the commands:

  • brew
  • git
  • rbenv
  • pry

And check for the following versions with command -v or command --version

@kingcons
kingcons / README.md
Last active August 29, 2015 14:16
Spotify OAuth Notes

Spotify OAuth Integration

If you have questions, I will be happy to expand these notes. Note that you need to add the httparty gem to your Gemfile for this code to work! You may also want to get RSpotify to handle this for you! Instructions for trying that are in their README here. I haven't used it before but am more than happy to help debug issues!

Supporting OAuth requires storing Access Tokens, Refresh Tokens, and Expiration Times on the User model. I have not included migrations for that in this code. You can see I assume column names of access_token,

@kingcons
kingcons / palette-search.lisp
Last active August 29, 2015 14:16
Palette Data Searcher
(ql:quickload 'famiclom)
(in-package :famiclom)
(defparameter *candidates* nil)
(defun init ()
(load-rom "/Users/brit/quicklisp/local-projects/famiclom/roms/smb.nes"))
(defun get-prg ()