Skip to content

Instantly share code, notes, and snippets.

public static ArrayList<Integer> cumSum(ArrayList<Integer> s, int acc){
ArrayList<Integer>l = new ArrayList<Integer>();
try{
(l = new ArrayList<Integer>(Arrays.asList(new Integer[]{s.remove(0)+acc}))).addAll(cumSum(s,l.get(0)));
}
finally{
return l;
}
}
#; Yang Zhou 260366321
.data
ZERO: .float 0.0
ONE: .float 1.0
TWO: .float 2.0
a: .float 0.7
b: .float 1.375
EPSILON: .float 0.0001 #; Value e in algorithm above.
INTERVAL: .float -5,5 #; Root is between these values.
fun occurs (a , Arrow(t,s) ) = (occurs (a,t) orelse occurs (a,s)) |
occurs (a, Product(t,s) ) = (occurs (a,t) orelse occurs (a,s)) |
occurs (t as ref(NONE), TVar(s as ref(NONE))) = (t = s)|
occurs (t, s) = false
.data
ZERO: .float 0.0
ONE: .float 1.0
TWO: .float 2.0
a: .float 0.7
b: .float 1.375
EPSILON: .float 0.0001
INTERVAL: .float 0,2
POLYORDER: .word 0
COEFFICIENTS:
| Let(dec1::decs, e2) => (case dec1 of
Val(expr,name) => if name = x then
Let(Val(subst s expr,name)::decs,e2)
else
let
val (varName,Let(rnDecs, rnExpr)) = if member name (freeVars e')
then rename (name,Let(decs, e2)) else (name,Let(decs, e2))
val Let(subDecs,subExpr) = subst s (Let(rnDecs, rnExpr))
in
Let(Val(subst s expr,varName)::subDecs,subExpr)
@hc5
hc5 / ajax_intercepter
Created March 12, 2012 04:32 — forked from creotiv/ajax_intercepter
Ajax Intercepter
<html>
<body>
<script>
var xml_type;
// branch for native XMLHttpRequest object
if(window.XMLHttpRequest && !(window.ActiveXObject)) {
.data
list1: .word 4,6,3,7,9,34,9,1,2,2,3,4,4,4,6
buf1: .space 60
list2: .word 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
buf2: .space 60
list3: .word -1,43,5,6,-7,2,3,4,-3,4,5,3,3,2,3
buf3: .space 60
test1: .asciiz "\nTesting for list1 - random list\n------------------------------\n"
test2: .asciiz "\nTesting for list2 - sorted list\n------------------------------\n"
test3: .asciiz "\nTesting for list3 - negative numbers\n------------------------------\n"
# $a0 = address of string
# $v0 = length of it
strlen:
addi $t1, $a0, 0
loop:
lb $t0, 0($a0)
addi $a0, $a0, 1
bne $t0, $zero, loop
sub $v0, $a0, $t1
addi $v0, $v0, -1 # -1 because \0 is counted
// ==UserScript==
// @name WebCT Multiple sessions and Never expiring mymcgill sessions
// @namespace fuck webct
// @description ^
// @include https://mycourses.mcgill.ca/webct/cobaltMainFrame.dowebct?*
// @include http://mycourses.mcgill.ca/webct/cobaltMainFrame.dowebct?*
// @include https://mymcgill.mcgill.ca/portal/page/portal*
// @include http://mymcgill.mcgill.ca/portal/page/portal*
// ==/UserScript==
@hc5
hc5 / wendy.py
Created December 24, 2011 22:45
#!/usr/bin/env python
_ =["#@"
,'$%&#@#%%#'
,'=+@#%#$####'
,'@@@@@'
'.++ ,`###`` `:+#@@@'
,];import string, os;M=[string
.count,lambda zz: zz|1<<6,lambda QQQ ,X,