Skip to content

Instantly share code, notes, and snippets.

@joech4n
joech4n / cli.md
Last active December 14, 2015 21:47 — forked from phrawzty/2serv.py
simple http server to dump request headers
$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python serv.py
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah
@joech4n
joech4n / s3DuByPrefix.sh
Last active November 28, 2018 16:40
Get bucket size and object count by first level prefix (i.e. bucket/prefix1, bucket/prefix2)
#!/bin/sh
BUCKETNAME=mybucketname; REGION=us-east-1; for prefix in $(aws s3api list-objects --bucket $BUCKETNAME --delimiter '/' --output text --region $REGION |grep COMMONPREFIX |tail -n+2| awk '{print $2}'); do echo "Totals for $prefix"; aws s3 ls --summarize --human-readable --recursive s3://$BUCKETNAME/$prefix --region $REGION ; done |grep Total
@joech4n
joech4n / ^readme.md
Last active July 15, 2020 11:07
CoffeeScript in Greasemonkey
@joech4n
joech4n / tamper-coffee.user.js
Last active April 23, 2020 02:51
Template from Tampermonkey
// ==UserScript==
// @name New Coffee-Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description shows how to use coffeescript compiler
// @author You
// @require http://coffeescript.org/extras/coffee-script.js
// @match https://site.com
// ==/UserScript==
/* jshint ignore:start */
@joech4n
joech4n / lake-s3-object-take-ownership.js
Created March 2, 2017 06:58 — 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 https://gist.github.com/joech4n/953c1cd6a36698c5d120
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
joech4n / WebhookTutorial.md
Created April 27, 2017 15:39 — forked from jagrosh/WebhookTutorial.md
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 https://zapier.com/ 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
@joech4n
joech4n / crawl.sh
Last active December 24, 2021 02:19
Dungeon Crawl Stone Soup (DCSS) Auto-Login tmux Script
#!/usr/bin/env bash
source ~/.crawl.secret # Get $USERNAME and $PASSWORD
# Example
# $ cat .crawl.secret
# USERNAME=myusername
# PASSWORD=mypassword
# name of tmux session
export SESSION="crawl"
### Keybase proof
I hereby claim:
* I am joech4n on github.
* I am joechan (https://keybase.io/joechan) on keybase.
* I have a public key ASByxl1laMCvQmpDbDkk-sjvofKPvwV7hMHk7hQzuPL4bAo
To claim this, I am signing this object:
@joech4n
joech4n / bookmarklet.html
Created September 2, 2021 23:06
Copy Gmail rfc822msgid Bookmarklet
<a class="bookmarklet" href="javascript:(function()%7Bwindow.prompt(%22Copy%20to%20clipboard%3A%20Ctrl%2BC%2C%20Enter%22%2C%20%22https%3A%2F%2Fmail.google.com%2Fmail%2Fu%2F0%2F%23search%2Frfc822msgid%3A%22%20%2B%20encodeURIComponent(document.getElementsByClassName(%22message_id%22)%5B0%5D.innerText.replace(%2F%5B%3C%3E%5D%2Fg%2C%20%22%22)))%7D)()">Copy Gmail rfc822msgid</a>