Skip to content

Instantly share code, notes, and snippets.

View sgml's full-sized avatar

psweatte sgml

View GitHub Profile
@sgml
sgml / gist:374addfdd5c3a09ffc2cf22147b1c9ea
Created August 22, 2020 20:30 — forked from sirleech/gist:2660189
Python Read JSON from HTTP Request of URL
# 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']
@sgml
sgml / fluent.py
Created April 14, 2020 04:08 — forked from thinkingserious/fluent.py
Fluent Interface in Python Using Method Chaining and Reflection
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
@sgml
sgml / shibb-cas-get.sh
Created April 1, 2020 23:28 — forked from olberger/shibb-cas-get.sh
Connection to a web app protected via Shibboleth with curl
#!/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"
@sgml
sgml / SSOByPasser.ksh
Created April 1, 2020 23:28 — forked from getkub/SSOByPasser.ksh
CURL snippet to do commands on SSO (Siteminder etc) protected systems
#!/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"
@sgml
sgml / who-is-driving-refactor.html
Created November 29, 2019 12:33 — forked from cferdinandi/who-is-driving-refactor.html
A refactor of the vanilla JS Who's Driving app.
<!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">
@sgml
sgml / build.properties
Created December 28, 2018 17:32 — forked from douglascayers/build.properties
Force.com Migration Tool
#
# Specify System Administrator credentials
# that will login to Salesforce to retrieve the metadata.
#
# You will also need the security token.
#
# The server url is which instance to connect to:
# For sandboxes, use https://test.salesforce.com
# For production or developer orgs, use https://login.salesforce.com
#