This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load Json into a Python object | |
import urllib2 | |
import json | |
req = urllib2.Request("http://localhost:81/sensors/temperature.json") | |
opener = urllib2.build_opener() | |
f = opener.open(req) | |
json = json.loads(f.read()) | |
print json | |
print json['unit'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fluent: | |
def __init__(self, cache=None): | |
self._cache = cache or [] | |
# Build the cache, and handle special cases | |
def _(self, name): | |
# Enables method chaining | |
return Fluent(self._cache+[name]) | |
# Final method call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#set -x | |
# Usage: shibb-cas-get.sh {username} {password} # If you have any errors try removing the redirects to get more information | |
# The service to be called, and a url-encoded version (the url encoding isn't perfect, if you're encoding complex stuff you may wish to replace with a different method) | |
DEST=https://myapp.example.com/ | |
SP=https://myapp.example.com/index.php | |
IDP="https://myidp.example.com/idp/shibboleth&btn_sso=SSOok" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ksh | |
################################################################################# | |
# | |
# CURL snippet to do commands on SSO (Siteminder etc) protected systems | |
# This script will set cookies in one server | |
# Copies the cookie information into another server | |
# Imports the cookie information to maintain seemless CURL commands | |
# | |
################################################################################# | |
page_name="ABC_Test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector("#function-ul").setAttribute("accesskey","B") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clicker = window.setInterval(() => $(".show-more .text-center button").click(), 5000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Who should drive?</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<!-- Styles --> | |
<style type="text/css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x = 2; | |
var y = 8; | |
var a = function(b) { return function(c) { return x + y + Math.abs(b) + c; } }; | |
// Statement will go here | |
Object.defineProperty(Math, 'random', {get() { return function(){ return 0; }}}) | |
var fn = a(x); | |
x = 4; | |
console.log(fn(Math.random() * 10)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var spy = 'window.releaseEvents()'.replace(/^/,"spyOn(").replace(/\.([a-zA-Z]+)/, ", '$1'").replace(/[(][)]+$/,')'); | |
var expect = 'window.releaseEvents()'.replace(/^/, "expect('").replace(/[(][)]+/, '').replace(/$/,"').toHaveBeenCalled()") | |
console.log('spy: ' + spy); | |
console.log('expect: ' + expect); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XMLHttpRequest.prototype.send = function(){return this.toString()} | |
var foo = new XMLHttpRequest; | |
foo.open('get','data:text/html,<html><p>hi</p></html>'); | |
foo.send(); |
NewerOlder