Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<title>Test</title>
</head>
<script async>
/*
relay
usbProductId: 24577
usbVendorId: 1027
const { SerialPort } = require('serialport')
async function listSerialPorts() {
await SerialPort.list().then((ports, err) => {
if (err) {
// document.getElementById('error').textContent = err.message
console.error(err.message)
return
} else {
// document.getElementById('error').textContent = ''
@phstc
phstc / retool-ddb-cdk.ts
Last active February 20, 2023 16:51
Retool DDB integration + AWS CDK IAM User and Policy
// See https://docs.retool.com/docs/dynamodb-integration
import { Stack, StackProps } from "aws-cdk-lib";
import * as dynamodb from "aws-cdk-lib/aws-dynamodb";
import * as iam from "aws-cdk-lib/aws-iam";
import { Construct } from "constructs";
export class DataStack extends Stack {
public readonly table: dynamodb.Table;
constructor(scope: Construct, id: string, props?: StackProps) {
@phstc
phstc / resize
Last active July 13, 2020 01:31
tell application "Google Chrome" to set the bounds of the front window to {1376, 0, 3440, 1440}
tell application "iTerm" to set the bounds of the front window to {1376, 0, 3440, 1440}
tell application "Slack" to set the bounds of the front window to {0, 0, 1376, 1440}
tell application "System Events" to tell application process "WhatsApp"
tell window 1
set {size, position} to {{1376, 1440}, {0, 0}}
end tell
@phstc
phstc / README.md
Last active September 15, 2019 18:38
K6 GitHub action

Run k6 for all branches prefixed with k6/, i.e. k6/my-test

@phstc
phstc / README.md
Last active May 20, 2019 13:15
Browse a GitHub pull request based on the branch name
  1. download gpr into ~/bin
  2. change org and repo in the script
  3. chmod +x ~/bin/gpr
  4. edit ~/.zshrc adding export PATH="$HOME/bin:$PATH"
  5. cd your-cloned-dir then gpr
@phstc
phstc / create-users.ts
Last active May 3, 2021 04:06
aws-cdk script for provisioning users + s3 buckets
/*
For deploying it:
Install aws-cdk: https://github.com/awslabs/aws-cdk then
npm run build
cdk deploy
*/
import cdk = require('@aws-cdk/cdk')
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://putsbox.com" />
<title>Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3914566-6', 'auto');
ga('send', 'pageview');
</script>
source 'https://rubygems.org'
gem 'sinatra'
gem 'active_support'