Skip to content

Instantly share code, notes, and snippets.

View sjehutch's full-sized avatar

scott hutchinson sjehutch

View GitHub Profile
@sjehutch
sjehutch / print_bot_id.py
Created May 22, 2017 16:03
print_bot_id.py
import os
from slackclient import SlackClient
### This is whatever name you gave your bot
BOT_NAME = 'toggle_bot'
### You get this by command export export SLACK_BOT_TOKEN='your slack token pasted here'
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
@sjehutch
sjehutch / scottec2.py
Created May 22, 2017 16:07
scottec2.py
import os
import time
import json
import requests
import boto3
from flask import Flask, request
from slackclient import SlackClient
import uuid
@sjehutch
sjehutch / isEven.java
Created June 1, 2017 02:09
check-even
public class forwhile {
public static void main(String[] args) {
// Create a method called isEvenNumber that takes a parameter of type int
// Its purpose is to determine if the argument passed to the method is
// an even number or not.
// return true if an even number, otherwise return false;
isEvenNumber(37);
}
package com.scotthutchinson;
/**
* Created by sjehutch on 6/3/17.
*/
public class VipCustomer {
// Create a new class VipCustomer
// it should have 3 fields name, credit limit, and email address.
// create 3 constructors
// 1st constructor empty should call the constructor with 3 parameters with default values
# Create a program that takes an IP address entered at the keyboard
# and prints out the number of segments it contains, and the length of each segment.
#
# An IP address consists of 4 numbers, separated from each other with a full stop. But
# your program should just count however many are entered
# Examples of the input you may get are:
# 127.0.0.1
# .192.168.0.1
# 10.0.123456.255
# 172.16
import random
highest = 1000
## We get the random number here
answer = random.randint(1 , highest)
## Now lets ask the person to guess
guess = 0
print ("guess a number between 1 and {}".format(highest))
### Check to see if guess = answer
odd = [1,3,5,7,9]
even = [2,4,6,8]
even.append(10)
numbers = odd + even
for i in numbers:
print (i)
numbers.sort()
#add to the program below so that if it finds a meal without spam
# it prints out each of the ingredients of the meal.
# You will need to set up the menu as we did in lines 5-13
menu = []
menu.append(["egg", "bacon" , "turkey"])
menu.append(["egg", "sausage", "bacon"])
menu.append(["egg", "spam"])
menu.append(["egg", "bacon", "spam"])
menu.append(["egg", "bacon", "sausage", "spam"])
@sjehutch
sjehutch / face.py
Created June 13, 2017 13:22
face-rekog-aws-lambda
import json
import boto3
def lambda_handler(event, context):
source = event['source']
target = event['target']
client = boto3.client('rekognition')
# This little gem checks if a user has seem the same article over and over and over
member = "Scott Hutchinson"
article = "Amazon buy's Whole Foods"
otherArticle = "Dog's start to replace people at Uber"
hasViewed = False
if member == "Scott Hutchinson":
if not hasViewed:
print(article)