Skip to content

Instantly share code, notes, and snippets.

import argparse
import boto3
from datetime import datetime
DEFAULT_REGION = "us-east-1"
DEFAULT_RESOURCE_LIST = ["arn:aws:s3:::cow.mothersect.info",
"arn:aws:lambda:us-east-1:441882069681:function:YvonneGo", ]
@andreburto
andreburto / index.html
Created July 10, 2022 23:00
Tiny web server that can eventually run on my phone.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Server</title>
</head>
<body>
<h1>Server</h1>
<p>This is a test.</p>
</body>
@andreburto
andreburto / toys.py
Last active November 22, 2022 12:47
#!/usr/bin/env python3
#####
import argparse
import sys
class MyToys:
@classmethod
def setup_args(cls, subparsers):
@andreburto
andreburto / upload-image.js
Created March 8, 2021 16:58
Node.js script to upload images to an S3 bucket.
const fs = require("fs")
const AWS = require('aws-sdk');
const bucketPath
const main = (imgPath) => {
fs.stat(imgPath, function(err, stats) {
if (!stats.isDirectory()) {
throw new Error(`"${imgPath}" is not a directory.`)
}
@andreburto
andreburto / shadow.html
Created October 17, 2020 20:24
Shadow DOM tinkering
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Shadow</title>
<script>
function addShadow() {
const theDiv = document.getElementById("theDiv2")
const shadowRoot = theDiv.attachShadow({mode: 'open'})
const para = document.createElement("p")
@andreburto
andreburto / Dockerfile.uwsgi
Created August 30, 2020 01:43
nginx proxy for docker-compose
FROM python:3.7-alpine
WORKDIR /test-dock
# Install any needed packages specified in requirements.txt
RUN apk update && \
apk add --no-cache make gcc g++ libgcc libstdc++ libsodium musl libzmq zeromq-dev linux-headers python3-dev && \
pip install --upgrade pip && \
pip install requests beautifulsoup4 pymysql flask uwsgi && \
rm -Rf /tmp/* && \
@andreburto
andreburto / main.py
Last active August 8, 2020 01:41
gamer:bit + micro:bit = 5x5 canvas
MAX_B = 9
MAX_X = 5
MAX_Y = 5
b = MAX_B
x = 0
y = 0
d_s = [[0 for c in range(0, MAX_X)] for r in range(0, MAX_Y)]
' Credit where it is due:
' http://computerperformance.co.uk/
' https://msdn.microsoft.com/en-us/library/aa394372(v=vs.85).aspx
' ----------------------------------------------------------------------
Option Explicit
Dim objWMIService, objShell, objProcess
Dim strComputer, colProcess, procName, procPath
procName = "notepad++.exe"
strComputer = "."
# Tomcat commands
Set-Variable -Name tomcat_path -Value "C:\path\to\apache-tomcat\bin\" -Scope global -Force
function start-tomcat {
$return_to = Get-Location
set-location -Path $tomcat_path
start-process .\startup.bat
Set-Location $return_to
}
<!DOCTYPE html>
<html>
<head>
<title>Calculator</title>
<script>
function checkSize() {
var html = document.documentElement;
var divC = document.getElementById("interface");