Skip to content

Instantly share code, notes, and snippets.

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']
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()
})
import random
randoms = []
while len(randoms) < 10:
randoms.append(random.randrange(0,10))
# 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:')
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(
...
)
package main
import (
"fmt"
"encoding/base64"
"os"
)
func main() {
var es string
package main
import (
"net/http"
"io/ioutil"
"fmt"
"time"
)
var netClient = &http.Client {
function fibber(n){
if(n == 0){
return 0;
}
if(n == 1){
return 1;
}
else{
return fibber(n-1) + fibber(n-2);
}
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:
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)