Skip to content

Instantly share code, notes, and snippets.

(def fib (lazy-cat '(0N 1N) (map + (rest fib) fib)))
;(nth fib 1000)
;43466557686937456435688527675040625802564660517371780
;40248172908953655541794905189040387984007925516929592
;25930803226347752096896232398733224711616429964409065
;33187938298969649928516003704476137795166849228875N
@kespindler
kespindler / gist:1933962
Created February 28, 2012 17:52
Python Null object, behaves like nil in Objective-C
## {{{ http://code.activestate.com/recipes/68205/ (r1)
#!/user/bin/env python
"""null.py
This is a sample implementation of the 'Null Object' design pattern.
Roughly, the goal with Null objects is to provide an 'intelligent'
replacement for the often used primitive data type None in Python or
Null (or Null pointers) in other languages. These are used for many
@ChiaraHsieh
ChiaraHsieh / Sublime Text 2 Markdown Theme Editing.md
Last active December 22, 2015 21:39
Sublime Text 2 markdown syntax highlighting. Add tinkering code segment to your current .tmTheme. Edit the font colors in .tmTheme according to the sector names indicated in the "Markdown Theme Editing.md" gist. (Default color scheme: Green, designed for Phoenix Dark Green - Eighties.tmTheme)

Markup: Heading

Header


The line above is Markdown separator

  • This
  • Is
@MoyTW
MoyTW / xhrio_examples.cljs
Last active July 16, 2016 15:14
Some basic examples of how to use XhrIo. Server is at: https://github.com/MoyTW/BlogSnippets/tree/master/XhrIoExamples
(ns xhrio-examples.examples
(:require [goog.net.XhrIo :as xhrio]
[goog.structs :as structs]
[goog.Uri.QueryData :as query]))
(def get-text-url "http://localhost:3000/get-text")
(def get-json-url "http://localhost:3000/get-json")
(def post-url "http://localhost:3000")
(def post-form-url "http://localhost:3000/post-form")
(def post-json-url "http://localhost:3000/post-json")
@babyking
babyking / autohotkey.ahk
Last active December 18, 2019 03:01
自己使用的Autohotkey 脚本 绝大多数的习惯与我的MAC上定义快捷键是一致的. mac上实现此脚本中快捷键主要是通过 keyremap4macbook来实现的.大部分定义受vi以及unix的一些快捷键影响,另外,刚刚买了一个hhkb键盘,部分定义也受其启发.
/*
* email: babyking1949@gmail.com
* update: 2013/3/9
*/
;常用快捷命令
:://cmd:: ;打开命令行
Run cmd
return
@johnboxall
johnboxall / dns.py
Created August 15, 2011 21:57
Twisted DNS server!
# http://notmysock.org/blog/hacks/a-twisted-dns-story.html
# http://blog.inneoin.org/2009/11/i-used-twisted-to-create-dns-server.html
# twistd -y dns.py
import socket
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
from twisted.names import dns
from twisted.names import client, server
@aaronwolen
aaronwolen / slides.md
Last active November 11, 2022 23:57
Pandoc template to generate reveal.js slideshows.

% Title % Name % Date

My first slide

List

@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@takeshixx
takeshixx / hb-test.py
Last active March 9, 2024 13:37
OpenSSL heartbeat PoC with STARTTLS support.
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {