Skip to content

Instantly share code, notes, and snippets.

View jameswhite's full-sized avatar
📁
copying files

James S White jameswhite

📁
copying files
View GitHub Profile
@jameswhite
jameswhite / aws_saml.py
Created October 4, 2019 15:08 — forked from JoeyG1973/aws_saml.py
aws saml login with session that auto refreshes.
# Took this:
# https://s3.amazonaws.com/awsiammedia/public/sample/SAMLAPICLIADFS/samlapi_formauth_adfs3.py
# converted to boto3 and smooshed it together with this:
# https://gist.github.com/kapilt/ac8e222081f63ba64e93
# which gave birth too this:
import sys
import botocore
import boto3
import requests
homeassistant:
pip.installed:
- bin_env: '/usr/bin/pip3'
python3-pip:
pkg.installed
cython3:
pkg.installed
@jameswhite
jameswhite / SslUtil.java
Created January 16, 2017 03:01 — forked from sharonbn/SslUtil.java
SSL/TLS connection from Eclipse Paho Java client to mosquitto MQTT broker
import java.io.*;
import java.nio.file.*;
import java.security.*;
import java.security.cert.*;
import javax.net.ssl.*;
import org.bouncycastle.jce.provider.*;
import org.bouncycastle.openssl.*;
public class SslUtil
#!/usr/bin/env perl
use LWP::UserAgent;
use Net::MQTT::Simple;
use JSON;
use Data::Dumper;
my $mqtt = Net::MQTT::Simple->new("127.0.0.1");
my $color = {
'red' => hex("0x0000"),
'orange' => hex("0x1800"),
'yellow' => hex("0x4000"),
Last Updated: 6 November, 2015
README APACHE FORTRESS END-TO-END SECURITY TUTORIAL:
----------------------------------------------------------------------
Covers these sections:
SECTION I - Machine Setup:
SECTION II - Apache Fortress Ten Minute Guide:
SECTION III - Apache Fortress End-to-End Security Tutorial
SECTION IV - Wicket Sample
def flaky_code()
unless @flaky_code_works
@flaky_code_works = true
raise 'wtf'
end
puts "works eventually lol"
end

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

B-cycle Widget

Screenshot

B-cycle is a bike sharing service that operates in several American cities. More information at their website. This widget allows you to use the station ID in a widget to get the current count of bikes and docks available to show on your Dashing dashboard.

Demo

A demo repository is available on GitHub and here is a live Dashboard on Heroku.

#!/usr/bin/env ruby
require 'base64'
require 'digest'
# get 16 random hex bytes
#
def new_salt
16.times.inject('') {|t| t << rand(16).to_s(16)}
end
#!/usr/bin/env python
import socket
import sys
if len(sys.argv) != 3:
print "Usage: %s host:port destfile.jpg" % sys.argv[0]
sys.exit(1)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host, port = sys.argv[1].split(':')