Skip to content

Instantly share code, notes, and snippets.

View G-Goldstein's full-sized avatar

Graham Goldstein G-Goldstein

View GitHub Profile
@G-Goldstein
G-Goldstein / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# The print function
print('Hello') # Hello
print(3) # 3
# Variables
greeting = 'Hello'
# Challenge one: What does this function do? How do you use it?
def welcome(name):
return 'Hello ' + name
# Solution:
### When called and a name passed, this function returns a greeting string for that name. Importantly, this function doesn't print anything to the console, it just creates a string that we can then print later, or do other things with.
person = 'Graham'
# Lists
numbers = [3, 5, 7, 4, 2]
## Don't worry about remembering the syntax, as long as you can refer back to an example.
print(numbers)
print(max(numbers))
def all_possible_ips():
for number in range(255):
yield '172.31.32.' + str(number)
#########################################################
import unittest
class SaunaTests(unittest.TestCase):
def all_possible_ips():
for number in range(10, 255):
yield '172.31.32.' + str(number)
def all_available_ips(unavailable):
for ip in all_possible_ips():
if ip not in unavailable:
yield ip
#########################################################
import pyVmomi # Use the pyVmomi module we downloaded
import pyVim.connect
import ssl # Use the ssl module from the standard library to avoid certification here.
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
context.verify_mode = ssl.CERT_NONE
host='???' ## Ask another team member for these credentials, or use your own!
user = '???' ## Be careful about uploading credentials to public source repositories!
password = '???'
-- Begin lines with two dashes to have the SQL engine ignore them. Great for comments or for storing an old line of code that you might want to use again later.
-- IBM i command STRSQL enters interactive SQL, from which you can run SQL statements.
-- The SOFPACK table stores information about software packages.
-- In SQL, use SELECT to query tables.
-- The * here is a wildcard meaning all columns.
SELECT * FROM sofpack
@G-Goldstein
G-Goldstein / docker_dojo_1_cheat_sheet.md
Last active February 8, 2019 16:48
Docker Dojo 1 Cheat Sheet

Terminology

A Docker image is a template for an application, together with its dependencies, runtime environment and metadata.

A Docker container is a running instance of a Docker image.

Commands

Use command docker alone to see Docker usage. You may need root access.

@G-Goldstein
G-Goldstein / docker_dojo_2_cheat_sheet.md
Last active March 1, 2019 13:58
Docker Dojo session 2

Main process, and container lifecycle

https://hub.docker.com/_/busybox

For busybox, the default execution is sh. So, after using run, we find ourselves in a shell environment:

docker run -it busybox

But we can specify an alternate command to run in the busybox container by appending it to the Docker run command: