This is a lua program that will run Conways Game of Life simulations for ComputerCraft. This code also runs in a unix shell (used for testing).
This was written a fair while ago and could probably use some cleanup.
| #!/usr/bin/env python3 | |
| import boto3 | |
| s = boto3.Session(profile_name='profile') | |
| ec2 = s.resource('ec2') | |
| instances_to_stop_filter = [ | |
| { 'Name':'tag:Stoppable', 'Values': ['true'] }, | |
| { 'Name':'instance-state-name', 'Values': ['running'] } |
| from IPython.display import display_html, display_javascript | |
| import uuid | |
| from jinja2 import Environment, BaseLoader | |
| def display_request(r): | |
| rq_id = str(uuid.uuid4()) | |
| rs_id = str(uuid.uuid4()) | |
| template = Environment(loader=BaseLoader()).from_string("""<div class='dr'> | |
| {% if r.ok %} | |
| <div class='dr_status dr_success' style='height: 24px; width: 100%; background-color: lightgreen;'>Successful response {{r.status_code}} for {{r.request.url}}</div> |
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: supervisord | |
| # Required-Start: $remote_fs | |
| # Required-Stop: $remote_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Example initscript | |
| # Description: This file should be used to construct scripts to be | |
| # placed in /etc/init.d. |
| import random | |
| from bs4 import BeautifulSoup | |
| import requests | |
| b = BeautifulSoup(requests.get('http://www.theonion.com/features/horoscope').text, 'html.parser') | |
| astro = random.choice(b.findAll("li", {"class": "astro"})) | |
| print(astro.find('div', {'class': 'large-thing'}).get_text()) |
| from contextlib import contextmanager | |
| @contextmanager | |
| def start_and_end(): | |
| print 1 | |
| yield | |
| print 3 | |
| # prints 1, 2 and 3 in order | |
| with start_and_end(): |
This is a lua program that will run Conways Game of Life simulations for ComputerCraft. This code also runs in a unix shell (used for testing).
This was written a fair while ago and could probably use some cleanup.
| tell application "Google Chrome" | |
| set windowList to every tab of every window whose URL starts with "https://mail.google.com" | |
| repeat with tabList in windowList | |
| set tabList to tabList as any | |
| repeat with tabItr in tabList | |
| set tabItr to tabItr as any | |
| delete tabItr | |
| end repeat | |
| end repeat | |
| end tell |
| #!/usr/bin/env ruby | |
| require 'net/http' | |
| require 'json' | |
| gitlab_token = "YOUR TOKEN" | |
| gitlab_uri = "URL GITLAB" | |
| # number of repositories to display in the list | |
| # order the list by the numbers | |
| ordered = true |