Skip to content

Instantly share code, notes, and snippets.

View jorke's full-sized avatar
💭
is typing..

Jorke Odolphi jorke

💭
is typing..
View GitHub Profile
@jorke
jorke / formdata-post.js
Last active October 24, 2024 23:32
s3 presigned post example with content-type - NOTE field.
import fs from 'node:fs';
import {
S3Client,
PutObjectCommand
} from "@aws-sdk/client-s3";
import { createPresignedPost } from '@aws-sdk/s3-presigned-post';
import FormData from 'form-data';
const client = new S3Client({ region: "ap-southeast-2" });
@jorke
jorke / put.js
Created October 24, 2024 11:09
signed s3 upload
import https from "node:https";
import { XMLParser } from "fast-xml-parser";
import fs from 'node:fs';
import {
S3Client,
PutObjectCommand
} from "@aws-sdk/client-s3";
import {
getSignedUrl,
@jorke
jorke / notebook.ipynb
Last active May 3, 2021 03:54
rekognition-testing.ipnyb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jorke
jorke / acm_dns.tf
Created October 11, 2019 04:40
create acm cert with DNS validation
terraform {
required_version = ">= 0.12"
}
# default region required.
provider "aws" {
region = "us-east-1"
}
provider "aws" {
@jorke
jorke / iamreset.sh
Created February 15, 2019 00:25
force iam user to reset password
for x in $(aws iam list-users --output text --query 'Users[*].UserName');
do
echo "$x?"
read choice
case "$choice" in
y|Y ) echo $(aws iam update-login-profile --user-name $x --password-reset-required);;
n|N ) echo "no";;
* ) echo "invalid";;
esac
;
@jorke
jorke / rpi-install-chef
Last active March 25, 2017 11:13
installs ruby then pulls chef
apt-get install gcc make libssl-dev
cd /usr/src
wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.6.tar.gz
tar -xvzf ruby-2.2.6.tar.gz
cd ruby-2.2.6
#cloud-config
apt_update: true
apt_upgrade: false
apt_preserve_sources_list: true
packages:
- openjdk-7-jre-headless
- awscli
- git
@jorke
jorke / gitbashprompt-bashrc.sh
Created October 20, 2016 19:56
bash prompt
function confirm () {
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
@jorke
jorke / gfclean.sh
Created October 20, 2016 14:00
cleans up merged remote branches
git push origin $(git branch -r --merged origin/master | sed "s/origin\\//:/" | egrep -v "HEAD|master|dev")
#! /bin/sh
# /etc/init.d/foobar
# The following part always gets executed.
echo "This part always gets executed"
# The following part carries out specific functions depending on arguments.
case "$1" in
start)
echo "Starting foobar"