Skip to content

Instantly share code, notes, and snippets.


Joe Chan joech4n

View GitHub Profile
joech4n /
Last active Aug 29, 2015
Shorten link with via Python
#!/usr/bin/env python
# Requires config file at ~/
# [Defaults]
# Shortens URL via
# Input: URL from clipboard OR CLI argument
# Action: The shortened URL is put on the clipboard, ready for pasting. You'll be notified via growlnotify that your link is ready.
joech4n /
Last active Aug 29, 2015 — forked from von/
From | Default config file is ~/.<SCRIPT FILE NAME>
#!/usr/bin/env python
import argparse
import ConfigParser
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--conf_file",
help="Specify config file", metavar="FILE", default=os.path.expanduser('~') + '/.' + os.path.basename(__file__)))
args, remaining_argv = parser.parse_known_args()
defaults = {
"option1" : "some default",
joech4n / filter.bash
Last active Aug 29, 2015
MathJS - Alfred Workflow Script Filter
View filter.bash
# Created with the following resources
# Bootstrapped workflow here is probably better:
/usr/local/bin/node <<-'CODE'
try {
var query = "{query}";
joech4n / gcalc.rb
Created Mar 20, 2015
Google Calculator - Alfred Workflow Script Filter
View gcalc.rb
load 'alfred_feedback.rb'
require 'logger'
require 'uri'
# Set up logging
file ='/tmp/alfred-workflow-gcalc.log', File::WRONLY | File::APPEND | File::CREAT)
logger =
logger.level = Logger::WARN
#logger.level = Logger::DEBUG # Uncomment this for debug output
joech4n /
Last active Oct 16, 2015
Get S3 Signed URL in Python
#!/usr/bin/env python
# Latest copy of this will be found at
import argparse
import boto
import sys
parser = argparse.ArgumentParser(description='Generate an S3 signed URL')
parser.add_argument('bucket', help='bucket name')
parser.add_argument('key', help='prefix/key')
joech4n /
Last active Dec 14, 2015 — forked from phrawzty/
simple http server to dump request headers
$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah
joech4n / textexpander_gen_from_atext.rb
Last active Dec 22, 2015 — forked from ttscoff/textexpander_gen.rb
Background: Forked from Brett's script to handle exported .csv from aText
View textexpander_gen_from_atext.rb
require 'csv'
require 'erb'
require 'cgi'
if ARGV.length == 2
input_csv = ARGV[0]
output_te = ARGV[1]
unless output_te =~ /\.textexpander$/
puts "Second argument must have a '.textexpander' extension."
joech4n /
Last active Feb 24, 2016 - Send Boxcar Notification with CLI (Python)
#!/usr/bin/env python
import os
import sys
import subprocess
import argparse
import ConfigParser
import shlex
joech4n / lake-s3-object-take-ownership.js
Created Mar 2, 2017 — forked from williamtsoi1/lake-s3-object-take-ownership.js
a lambda function to automatically take ownership of any objects written into an s3 bucket. Inspired by
View lake-s3-object-take-ownership.js
console.log('Loading event');
var aws = require('aws-sdk');
var s3 = new aws.S3({apiVersion: '2006-03-01'});
exports.handler = function(event, context) {
// uses s3.listBuckets to fetch the canonical ID of the AWS account
s3.listBuckets(function(err,data) {
if (err) {
console.log(err, err.stack);
} else {
joech4n /
Created Apr 27, 2017 — forked from jagrosh/
Simple Webhook Tutorial (Twitter -> Discord)

Simple Webhook Tutorial

In this tutorial, I will be explaining how to set up a simple webhook to relay your tweets to a Discord channel

Step 1 - Register on Zapier

  1. Go to and create an account (if you don't already have one).

Step 2 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send Tweets
You can’t perform that action at this time.