Skip to content

Instantly share code, notes, and snippets.

View ispyhumanfly's full-sized avatar

Dan Stephenson ispyhumanfly

View GitHub Profile
@ispyhumanfly
ispyhumanfly / students.py
Created March 21, 2020 22:05
Iterating over Dictionaries in Python3 and grabbing values from multi-dimensional arrays
student = {"name": "John", "age": 25, "courses": ["This", "That", "The Other", "And Another"]}
# Give me the list of all courses available in this Dictionary.
for key, value in student.items():
if key == "courses":
for course in value:
print (course)
import boto3 as aws
import logging
import time
import os
import paramiko
from botocore.exceptions import ClientError
def main():
ec2 = aws.client('ec2')
for reservation in response_2["Reservations"]:
for instance in reservation["Instances"]:
# This sample print will output entire Dictionary object
print(instance)
# This will print will output the value of the Dictionary key 'InstanceId'
print(instance["InstanceId"])
#!/usr/bin/env php
<?php
require './simple_html_dom.php';
/* Bleu Libellue */
$html = file_get_html('https://www.bleulibellule.com/');
<?php
//namespace simplehtmldom_1_5;
/**
* Website: http://sourceforge.net/projects/simplehtmldom/
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
* Contributions by:
* Yousuke Kumakura (Attribute filters)
* Vadim Voituk (Negative indexes supports of "find" method)
#!/usr/bin/env php
<?php
require './simple_html_dom.php';
$html = file_get_html('https://www.bleulibellule.com/');
/* Links */
@ispyhumanfly
ispyhumanfly / jquery-delayedautoscroll.js
Last active December 29, 2016 01:14
jquery-delayedautoscroll
setTimeout(function() {
$("html, body").animate({
scrollTop: 848
}, 1000)
}, 4000)
@ispyhumanfly
ispyhumanfly / input.storage.json
Last active December 1, 2016 05:47
An example of storing KPI data in a object store.
"objects": [
{
"kpis": [
{
"2016": {
"plants": [
{
"warren": {
root@ip-10-0-238-38:/home/ubuntu# x84
Traceback (most recent call last):
File "/usr/local/bin/x84", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in <module>
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 444, in _build_master
ws.require(__requires__)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require
needed = self.resolve(parse_requirements(requirements))
@ispyhumanfly
ispyhumanfly / gist:19043d340d78385ea624
Created November 13, 2014 21:48
Example of using Mojo's upload handling...
if ($self->req->upload('photos')) {
push @photos,
process_photo($self->req->upload('photos'), $new_content->id);
$MODEL->resultset('Content')->search({id => $new_content->id})
->update({photos => "@photos"})
if scalar @photos >= 1;
}