Skip to content

Instantly share code, notes, and snippets.

View danlamanna's full-sized avatar
🏠

Dan LaManna danlamanna

🏠
View GitHub Profile
{
"metadata": {
"name": "",
"signature": "sha256:9d0a83225f170377ef40bebd15348e81d24b51425191fbadd75c0ba6afaee38a"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
use "hw1.sml";
print("-------------------------\n");
print("-- Starting tests...\n");
print("primepower;\n");
primepower;
print("primepower(0);\n");
primepower(0);
fun decbin(0, l) = l
| decbin(n, l) =
let
val quotient = floor(real(n) / 2.0);
val remainder = n mod 2;
in
decbin(quotient, remainder::l)
end
lastDigit :: Integer -> Integer
lastDigit n = if n >= 10 then n `mod` 10
else n;
dropLastDigit :: Integer -> Integer
dropLastDigit n = n `div` 10
toDigits :: Integer -> [Integer]
toDigits 0 = []
toDigits n = if n < 0 then []
fun rev(nil, M) = M
| rev(x::xs, ys) = rev(xs, x::ys);

To Watch

Utopia? Series?

24

Agents of Shield

American Horror Story

Seen season 1

Archer

Awake

Band of Brothers

Battlestar Galactica

add_filter( '
;; with cursor directly after single quote:
(looking-back "add_\\(action\\|filter\\)([[:space:]]?+\\('\\|\"\\)") => t
(match-string 0 "add_\\(action\\|filter\\)([[:space:]]?+\\('\\|\"\\)") => "add_\\(ac" ;; expects whole string
(match-string 1 "add_\\(action\\|filter\\)([[:space:]]?+\\('\\|\"\\)") => nil ;; expects action or filter
from scrapy.selector import HtmlXPathSelector
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.item import Item, Field
class LinkItem(Item):
url = Field()
referer = Field()
status = Field()
fun factorial(n) = if n = 0
then 1
else n * factorial(n-1)
---
- hosts: amd64_personal
remote_user: dan
vars:
- root_password: "foo"
tasks:
- name: change root password
sudo: yes
user:
name=root