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
(declaim (optimize (debug 0) (safety 1) (speed 1))) | |
(defmacro aref-with-default (default array &rest subscripts) | |
`(if (array-in-bounds-p ,array ,@subscripts) | |
(aref ,array ,@subscripts) | |
,default)) | |
(defmacro iterate-array (dimensions array &rest body) | |
(labels ((index-symbol (n) | |
(intern (concatenate 'string "V" (write-to-string n)))) |
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
(require-extension inotify) | |
(require-extension posix) | |
(require-extension srfi-37) | |
;;; Utility functions. | |
(define (negate fn) | |
(lambda (a) | |
(not (fn a)))) |
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
;;; Battery monitoring daemon script. | |
(require-extension shell) | |
(require-extension srfi-1) | |
;;; Constant values. | |
;;; Battery level control interval, in seconds. |
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
uniform vec2 resolution; | |
uniform float zoom, panx, pany; | |
uniform int depth; | |
void main(void) | |
{ | |
// vec2 res = vec2(1366.0, 768.0); | |
vec2 uv = gl_FragCoord.xy / resolution.xy * zoom; | |
float scale = resolution.y / resolution.x; | |
uv=((uv-0.5)*5.5); |
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/perl -w | |
use strict; | |
use warnings; | |
sub phobosDecrypt { | |
reverse shift =~ tr/A-Z/X-ZA-W/r; | |
} | |
print "Enter encrypted message:\n"; |
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/perl -w | |
# USAGE: | |
# | |
# /FORTUNE | |
# - Outputs a random fortune. | |
use strict; | |
use vars qw($VERSION %IRSSI); |
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
uniform vec2 resolution; | |
uniform float zoom, panx, pany; | |
void main(void) | |
{ | |
// vec2 res = vec2(1366.0, 768.0); | |
vec2 uv = gl_FragCoord.xy / resolution.xy * zoom; | |
float scale = resolution.y / resolution.x; | |
uv=((uv-0.5)*5.5); | |
uv.y*=scale; |
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
-- Requires installation of SDL2 https://github.com/haskell-game/sdl2 | |
-- and possibly GLUT https://hackage.haskell.org/package/GLUT | |
-- Using graphics code from https://wiki.haskell.org/OpenGLTutorial1 | |
module Main (main) where | |
import Control.Monad | |
import Linear | |
import Data.StateVar | |
import Foreign.C.Types (CInt) |
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
unfold :: (a -> Bool) -> (a -> a) -> a -> [a] | |
unfold stop step init | stop init = [] | |
| otherwise = init : unfold stop step (step init) | |
modulo = curry $ length . unfold (uncurry (>)) (\dn -> subtract (fst dn) <$> dn) |
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 Control.Applicative | |
import Data.Monoid | |
import Control.Monad | |
import Control.Monad.Loops | |
main :: IO () | |
main = putStrLn =<< intersperse ':' <$> getLines | |
-- | The class of types that support short-circuiting on e.g. empty, false, error - almost the same as but not quite Alternative | |
class Circuit a where |
NewerOlder