Skip to content

Instantly share code, notes, and snippets.

View oubiwann's full-sized avatar
💭
🌌

Duncan McGreggor oubiwann

💭
🌌
View GitHub Profile
@gbrayut
gbrayut / test.sh
Last active October 11, 2022 00:36
Firewall Testing
#Test all A entries for a DNS record to see if you can connect to port 443:
dig +short microsoft.com. | xargs -I {} nc -v -w2 {} 443
#Example of output
Connection to 191.239.213.197 443 port [tcp/https] succeeded!
Connection to 104.43.195.251 443 port [tcp/https] succeeded!
Connection to 104.40.211.35 443 port [tcp/https] succeeded!
Connection to 23.100.122.175 port 443 (tcp) timed out: Operation now in progress
Connection to 23.96.52.53 443 port [tcp/https] succeeded!
@grav
grav / medley.md
Last active December 4, 2020 04:20
Getting Interlisp-D running with Medley on Debian 3.1

Install VirtualBox (eg on Mac: brew cask install virtualbox)

Download Debian 3.1 from here: https://virtualboxes.org/images/debian/

Create a new VM in VirtualBox and select the vdi file from the above archive as a disk. Check the VM settings:

  • Make sure the disk is mounted as an IDE device, SATA errors out on boot (in the Storage tab)
  • Also, make sure the pointing device is set to PS/2 Mouse (in the General tab)
(define root 52)
(define scale (pc:scale 4 'aeolian))
(define right-hand
(lambda (beat dur)
(play sampler
(pc:quantize (cosr (+ root 24) (cosr 5 3 1/2) 7/3) scale)
(cosr 80 20 7/3)
(* 2.0 dur))
(if (> (random) .6)
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active April 29, 2024 09:09
Reader Macros in Common Lisp

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

(defmodule imp (export (bar 0)))
(eval-when-compile
(defun import-function-1 (module function)
;(: io format '"~p~p~n" (list module function))
(let ((mod-fun (list_to_atom
(: lists concat (list module '":" function)))))
; (: io format '"~p~n" (list mod-fun))
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@amtal
amtal / life_sync_cell.lfe.clj
Created May 30, 2011 10:08
Conway's Life in Lisp Flavored Erlang...
;;; Global clock implementation of Life.
(defmodule life_sync_cell
(export (start_link 1) (set_neighbours 2) (tick 1)
(init 1) (handle_cast 2))
(using gen_server)
(behaviour gen_server))
(include-file "deps/lfe_utils/include/using.lfe")
;;; Exported:
(defmodule imp (export (bar 0)))
(eval-when-compile
(defun import-function-1 (module function)
;(: io format '"~p~p~n" (list module function))
(let ((mod-fun (list_to_atom
(: lists concat (list module '":" function)))))
; (: io format '"~p~n" (list mod-fun))
(defmodule lfe_riak
(import (rename erlang ((list_to_binary 1) l2b))
(rename riak_object ((get_value 1) get))
(from lists (foreach 2) (map 2) (foldl 3))
(rename dict
((merge 3) make-merged-dict)
((new 0) make-dict)
((from_list 1) make-dict-from-list)
((to_list 1) make-list-from-dict)))
(export (hello 0)