Skip to content

Instantly share code, notes, and snippets.

View cunneen's full-sized avatar

Mike Cunneen cunneen

  • Perth, Australia
View GitHub Profile
@cunneen
cunneen / copyCookies.js
Last active February 13, 2025 08:03
Export a website's cookies as JSON
window.confirm("Copy Cookies?") &&
(() => {
// modal (popup) div
const div = document.createElement("div");
div.setAttribute("style", "margin: auto; width: 25%; min-height: 25%; position: absolute; top: 25%; bottom: 25%; left: 25%; right: 25%; background-color: #ffe; padding: 1em; z-index:99999; border: 2px solid blue; border-radius: 1em; box-shadow: 4px 4px 8px #aaa;");
// document.cookies keys and values as JSON text
const cookiesJSONText = JSON.stringify(
Object.fromEntries(
document.cookie.split(/; ?/)
@cunneen
cunneen / icons
Created January 8, 2025 07:14 — forked from brutella/icons
Generate iOS, watchOS, and macOS app icons from one image
#! /bin/sh
function print_example() {
echo "Example"
echo " icons ios ~/AppIcon.pdf ~/Icons/"
}
function print_usage() {
echo "Usage"
echo " icons <ios|watch|complication|macos> in-file.pdf (out-dir)"
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@cunneen
cunneen / keybase.md
Created June 30, 2023 04:08
keybase.md

Keybase proof

I hereby claim:

  • I am cunneen on github.
  • I am cunneen (https://keybase.io/cunneen) on keybase.
  • I have a public key ASD2B9N4HIcB5mADJrgE9B3tBOEuBAdXxUo_0pjDUWo2UQo

To claim this, I am signing this object:

@cunneen
cunneen / machine.js
Created June 23, 2021 03:28
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@cunneen
cunneen / machine.js
Last active June 15, 2021 14:42
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@cunneen
cunneen / getHashedPassword.js
Created April 12, 2021 09:36
Meteor Password Hashing
// Based on https://forums.meteor.com/t/accounts-password-in-nodejs/45154
const prompts = require('prompts');
const hashPassword = require('./meteorpass')
let pass;
prompts([{
type: 'password',
name: 'password',
message: 'Enter plaintext password',
@cunneen
cunneen / create-new-react-native-project.sh
Last active October 19, 2021 13:49
Create a new react native app, specifying app name and package name
#!/usr/bin/env bash
# get the full path for the current dir
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
###### prompt for values
# get the new app name
read -p "Enter your new app name [Foo App]: " NEW_APP_NAME
NEW_APP_NAME=${NEW_APP_NAME:-"Foo App"}
@cunneen
cunneen / Frame android screenshots with ImageMagick.md
Last active December 27, 2021 16:36
Frame android screenshots with ImageMagick

Prerequisites

  1. A screenshot with the correct aspect ratio
  2. A device frame PNG with a transparent area where the screenshot will be placed See Facebook's Device Art
  3. GraphicsMagick / ImageMagick
  4. That's it.

Instructions

@cunneen
cunneen / makeicons.sh
Created August 13, 2018 03:03
Make a mac OS icns file from a single input file using imageMagick and iconutil
#!/usr/bin/env bash
infile=$1
if [ ! -f $infile ]; then
echo specify a filename as the first parameter.
exit 1;
fi
tempdir=$(mktemp --directory --suffix=.iconset --tmpdir=`pwd`)