Skip to content

Instantly share code, notes, and snippets.

@alexanderchan
alexanderchan / openselectioninatom
Created January 12, 2017 03:30
write a file and open the contents in atom
function run(input, parameters) {
ObjC.import('Cocoa');
var str = $.NSString.alloc.initWithUTF8String(input);
var jsonPath = Path('/tmp/test.json');
str.writeToFileAtomically(jsonPath.toString(), true);
var atom = Application('Atom')
atom.open(jsonPath)
@alexanderchan
alexanderchan / docker-cleanup-resources.md
Created December 10, 2018 21:14 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@alexanderchan
alexanderchan / package.json
Created January 18, 2019 17:49 — forked from adamreisnz/package.json
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Buczynski",
"url": "http://adambuczynski.com"
},
"license": "UNLICENSED",
@alexanderchan
alexanderchan / github_bitbucket_multiple_ssh_keys.md
Last active December 18, 2020 00:03 — forked from yinzara/github_bitbucket_multiple_ssh_keys.md
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@alexanderchan
alexanderchan / cli-example.ts
Last active October 10, 2023 22:37
quick commander example
#!/usr/bin/env node
import { config } from 'dotenv'
import { Command } from 'commander'
import { z } from 'zod'
config()
const exampleCommand = new Command()
.command('example-command')