Skip to content

Instantly share code, notes, and snippets.

View ruandre's full-sized avatar

Ruandré Janse van Rensburg ruandre

View GitHub Profile
@ruandre
ruandre / settings.md
Last active February 8, 2022 17:35
VSCode Settings
@ruandre
ruandre / s3-bucket-exists.js
Last active February 8, 2022 05:36
Check if S3 bucket exists using AWS SDK JavaScript Node.js
const AWS = require('aws-sdk')
const s3 = new AWS.S3()
const BUCKET_NAME = 'MyBucket'
async function main() {
try {
const data = await s3.headBucket({ Bucket: BUCKET_NAME }).promise()
return `Bucket "${BUCKET_NAME}" exists`
@ruandre
ruandre / shell-tips.md
Last active February 8, 2022 05:32
Linux Shell Tips (Bash, etc.)

Shell Tips

Mostly "notes to self" as I occasionally forget...

System info

uname -a
@ruandre
ruandre / PsResizeLongestSide1024.jsx
Last active February 7, 2022 18:15
Adobe Photoshop script to resize images to fit inside a 1024px box.
/***************************
NOT MAINTAINED! from ~2015
****************************/
// photoshop script to resize images proportionally to fit inside a 1024px box i.e. longest side/edge will equal 1024px
// useful when scaling down many large photos for web use, simply toss in a batch action
var activeDoc = app.activeDocument
var docWidth = activeDoc.width
var docHeight = activeDoc.height
@ruandre
ruandre / sublime-text-settings.md
Last active February 7, 2022 17:48
Sublime Text Settings

Sublime Text Settings

https://www.sublimetext.com/

Preferences.sublime-settings.json

{
  "always_prompt_for_file_reload": true,
  "bold_folder_labels": true,
@ruandre
ruandre / user-select.css
Last active February 7, 2022 17:30
Disable annoying highlight/select on click
/*
Disable annoying highlight/select on click
https://css-tricks.com/almanac/properties/u/user-select/
*/
.button {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
@ruandre
ruandre / aws-cli-dynamodb-scan.sh
Last active February 7, 2022 17:06
AWS CLI DynamoDB Scan
# https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
# https://docs.aws.amazon.com/cli/latest/index.html
# https://stedolan.github.io/jq/
aws dynamodb scan \
--table-name tableName \
--profile dev \
--page-size 5 | jq .Items[] | jq {field1:.field1.S,field2:.field2.S} | json2csv
@ruandre
ruandre / target-blank.html
Last active February 7, 2022 17:02
target blank security
<!--
https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/
https://medium.com/sedeo/how-to-fix-target-blank-a-security-and-performance-issue-in-web-pages-2118eba1ce2f
https://blog.dareboost.com/en/2017/03/target-blank-links-rel-noopener-performance-security/
-->
<a href="#" target="_blank" rel="noopener noreferrer">Link</a>
@ruandre
ruandre / settings.json
Last active February 7, 2022 16:10
Windows Terminal
{
"$help": "https://aka.ms/terminal-documentation",
"$schema": "https://aka.ms/terminal-profiles-schema",
"actions": [
{
"command": {
"action": "copy",
"singleLine": false
},
"keys": "ctrl+c"