This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
# Some boto3 client calls will paginate results | |
# This uses the S3 client to demonstrate how to enumerate through all results, even paginated | |
s3 = boto3.client('s3') | |
buckets = [] | |
results = s3.list_buckets() | |
buckets += results['Buckets'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const port = 3000 | |
const express = require('express') | |
const app = express() | |
app.use(function(req, res, next){ | |
console.log('Request:', req) | |
console.log('Response:', res) | |
next() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
randoms = [] | |
while len(randoms) < 10: | |
randoms.append(random.randrange(0,10)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# openpyxl demo | |
import openpyxl | |
w = 'workbook.xlsx' | |
wb = openpyxl.load_workbook(w) | |
for sheet in wb.sheetnames: | |
rows = tuple(wb[sheet].rows) | |
print('Row count: {0}'.format(len(rows)-1)) | |
print('Sample rows:') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ssl | |
from kmip.pie.client import ProxyKmipClient | |
from kmip import enums | |
from base64 import b64encode | |
from binascii import hexlify | |
# Setup a client | |
client = ProxyKmipClient( | |
... | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"encoding/base64" | |
"os" | |
) | |
func main() { | |
var es string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/http" | |
"io/ioutil" | |
"fmt" | |
"time" | |
) | |
var netClient = &http.Client { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fibber(n){ | |
if(n == 0){ | |
return 0; | |
} | |
if(n == 1){ | |
return 1; | |
} | |
else{ | |
return fibber(n-1) + fibber(n-2); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def F(n): | |
if n == 0: | |
return 0 | |
if n == 1: | |
return 1 | |
else: | |
return F(n-1) + F(n-2) | |
myints = [0] | |
while len(myints) < 10: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
p = '(\d+)' | |
pgroups = '(\d+)-(\d+)-(\d+)' | |
p2 = '-\d{2}-' | |
ssn = '012-34-5678' | |
# Returns a list: [ '012', '34', '5678' ] | |
matches_list = re.findall(p, ssn) |