Skip to content

Instantly share code, notes, and snippets.

import urllib2
import json
def getQuestion(categoryNumber):
url = 'https://opentdb.com/api.php?amount=1&category=' + str(categoryNumber) + '&type=boolean'
jsonString = urllib2.urlopen(url).read()
return json.loads(jsonString)["results"][0]
def lambda_handler(event, context):
question = getQuestion(27)
var remaining = [155, 156, 210, 211, 311, 318, 334, 336, 341, 347, 355, 420, 472, 519, 523, 552, 553, 564, 640, 704, 738, 743, 775, 780, 798, 803, 813, 817, 842, 895, 921, 924, 927, 947, 988, 989, 3011, 3340, 3363, 3608, 3727, 3746, 3753, 3755, 3766, 3768, 3834, 3841, 3848, 3860, 3861];
$.each(remaining, function(i, x) {
$('div')
.filter(function() { return $(this).text() == x; })
.css('background-color', 'red');
});
from __future__ import print_function
from boto3.dynamodb.conditions import Key, Attr
import boto3
import json
def lambda_handler(event, context):
instance = event['query']['instance']
data Tree a = Node a (Tree a) (Tree a) | None deriving (Show)
data List a = Suc a (List a) | Empty deriving (Show)
class AccFunctor f where
fmapWithState :: (s -> a -> b) -> (s -> a -> s) -> s -> f a -> f b
instance AccFunctor List where
fmapWithState _ _ _ Empty = Empty
fmapWithState f g s (Suc a next) = Suc (f s a) (fmapWithState f g nextState next)
@FlightOfStairs
FlightOfStairs / DecompTest.class
Created July 7, 2012 11:17
Decompilation of slightly different loops.
Classfile /home/alistair/Dropbox/Documents/Projects2011/ES/ES/DecompTest/build/classes/decomptest/DecompTest.class
Last modified 07-Jul-2012; size 558 bytes
MD5 checksum 37250440c1259a7b8a5610358541b6c0
Compiled from "DecompTest.java"
public class decomptest.DecompTest
SourceFile: "DecompTest.java"
minor version: 0
major version: 50
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
@FlightOfStairs
FlightOfStairs / MethodWeaver.groovy
Created May 27, 2012 00:25
ASM bytecode transformation to identify concrete class at runtime
package org.flightofstairs.honours.capture.agent
import org.flightofstairs.honours.common.Call
import org.objectweb.asm.MethodVisitor
import org.objectweb.asm.Opcodes
import org.objectweb.asm.Type
import org.slf4j.LoggerFactory
import org.objectweb.asm.tree.*
import org.objectweb.asm.tree.analysis.*