This file contains 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
#!/usr/bin/python2.6 | |
# -*- coding: utf-8 -*- | |
# from: https://lorenzod8n.wordpress.com/2007/05/25/pygame-tutorial-1-getting-started/ | |
import pygame | |
import pdb | |
from random import randrange, choice | |
x = y = 0 | |
running = 1 |
This file contains 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
;;; jamar.el --- What's the math? | |
;; Copyright (C) 2013 Cliff Rodgers | |
;; Author: Cliff Rodgers <cliff.rodgers@gmail.com> | |
;; Keywords: news, calendar, games | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or |
This file contains 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 wrap-region-in-md-kbd-tags () | |
"Wraps the selected region in HTML keyboard (<kbd></kbd>) tags | |
to create keyboard glyphs." | |
(interactive "r") | |
(save-excursion | |
(narrow-to-region (region-beginning) (region-end)) | |
(goto-char (point-min)) | |
(insert "<kbd>") | |
(goto-char (point-max)) | |
(insert "</kbd>") |
This file contains 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
* DONE Links with o-blog :o@blog:org@mode:emacs: | |
CLOSED: [2013-09-25 Wed 20:13] | |
Links are easily embedded into [[http://orgmode.org/][org-mode]] documents. Simply type =C-c | |
C-l= and enter =http://linkblah.com= at the prompt. Org-mode supports | |
a variety of [[http://orgmode.org/manual/External-links.html][link prefix types]]. | |
[[https://github.com/renard/o-blog][O-blog]] is slightly more complicated. | |
You can follow along by reading the raw =.org= source in this gist. |
This file contains 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
import os | |
os.system("open -a Microsoft\ PowerPoint") # For example. | |
os.system("open -a Preview ~/Desktop/printme.png") # And it works with | |
# file arguments | |
# too. |
This file contains 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
(defn filter-by [pred coll] | |
(let [grouped-map (group-by pred coll) | |
{true-list true | |
false-list false} grouped-map] | |
(merge [true-list false-list]))) | |
(= '[[1 3 5 7 9] [0 2 4 6 8]] (filter-by odd? (range 10))) | |
This file contains 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 R1) | |
(defvar R2) | |
(defvar R3) | |
(defvar R4) | |
(defun snesrand (&optional seed) | |
"Based on | |
https://github.com/optixx/snes/blob/master/libs/RANDOM.ASM " | |
(cond (seed | |
(setq R1 (ash seed -12)) |
This file contains 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
#include <Adafruit_NeoPixel.h> | |
// Parameter 1 = number of pixels in strip | |
// Parameter 2 = pin number (most are valid) | |
// Parameter 3 = pixel type flags, add together as needed: | |
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) | |
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) | |
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) |
This file contains 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
#include <Adafruit_NeoPixel.h> | |
// Parameter 1 = number of pixels in strip | |
// Parameter 2 = pin number (most are valid) | |
// Parameter 3 = pixel type flags, add together as needed: | |
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) | |
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) | |
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) | |
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) |
This file contains 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
(defn sample-without-replacement [coll] | |
"Returns a tuple in which the first value is the sample and the | |
second is a collection of the left over values. Does not preserve | |
the order of the input collection." | |
(let [shuffled (shuffle coll) | |
sample (last shuffled) | |
rest (pop shuffled)] | |
[sample rest])) |
OlderNewer