Skip to content

Instantly share code, notes, and snippets.

View cwgreene's full-sized avatar

cwgreene cwgreene

  • Exploding at the origin
View GitHub Profile
{
import System.Environment
}
%wrapper "basic"
$digit = 0-9
$alpha = [a-zA-Z]
tokens :-
$white+ ;
$digit+ {\s -> Int (read s) }
$alpha+ {\s -> Var s }
<html>
<body>
The Once the script is done, the value z should be the parsed rss feed. You can view it in the console and inspect it.
Since this involves an XMLHttpRequest, you'll want to run a local server, like
python -m SimpleHTTPServer
in the appropriate directory. You may well be able to embed the xml file itself within an html document.
<script>
oreq = new XMLHttpRequest();
p = new DOMParser();
/* Valid Typescript */
function f(x) {
return "hello world";
}
/* Invalid Typescript */
function f(x) {
if (x < 5)
return "hello world";
return 7;
/* Valid Typescript */
function f(x) {
return "hello world";
}
/* Invalid Typescript */
function f(x) {
if (x < 5)
return "hello world";
return 7;
@cwgreene
cwgreene / predictdump
Created July 8, 2017 07:54
prediction dump
array([[ 5.98662300e-03, 8.49877967e-37, 1.87665017e-09,
1.37775569e-09, 6.60619914e-09, 2.27707897e-09,
2.68214384e-09, 3.49235335e-10, 4.96529481e-07,
9.94012892e-01],
[ 5.98662300e-03, 8.49877967e-37, 1.87665017e-09,
1.37775569e-09, 6.60619914e-09, 2.27707897e-09,
2.68214384e-09, 3.49235335e-10, 4.96529481e-07,
9.94012892e-01],
[ 7.55321756e-02, 8.29070807e-13, 3.42998169e-02,
7.43584661e-03, 5.24340749e-01, 8.02793447e-03,
@cwgreene
cwgreene / hackyascent.py
Created July 8, 2017 09:42
The solution
# Initiate our vector
auto_next = scipy.misc.imread("starting_file_that_is_32x32x3.png")
# create the thing that pokes in the dx_i direction
def dxi(i,j,k):
a = np.zeros(shape=(32,32,3))
a[i][j][k] = 1
return a
# Create an array of all possible directions to poke in
@cwgreene
cwgreene / javap.md
Last active October 28, 2017 20:29
Javap Output for com/google/common/cache/CacheLoader$SupplierToCacheLoader.class

What happened to #17 in the constant pool?

Classfile /home/chris/Downloads/jartest/com/google/common/cache/CacheLoader$SupplierToCacheLoader.class
  Last modified Dec 9, 2015; size 1361 bytes
  MD5 checksum 77190ae73fdc93505ceada7d6f86eacd
  Compiled from "CacheLoader.java"
final class com.google.common.cache.CacheLoader$SupplierToCacheLoader<V extends java.lang.Object> extends com.google.common.cache.CacheLoader<java.lang.Object, V> implements java.io.Serializable
  minor version: 0
  major version: 50

Ocaml code:

type bob =
    | Add of int*int
    | Mul of int*int;;
let mulpy v = match v with
    | Add (a, b) -> a + b
    | Mul (a, b) -> a * b;;
print_string (string_of_int (mulpy (Mul (3, 2))));;
import sys
for line in open(sys.argv[1]):
print line,