Skip to content

Instantly share code, notes, and snippets.

View antoniojtorres's full-sized avatar
🥃
Hey now

Antonio Torres antoniojtorres

🥃
Hey now
View GitHub Profile
@nabucosound
nabucosound / heroku_env_copy.sh
Created December 30, 2013 12:40
Script to copy environment variables from an existing heroku app to another one
#!/bin/bash
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/
set -e
sourceApp="$1"
targetApp="$2"
while read key value; do
@milo
milo / github-webhook-handler.php
Last active October 29, 2024 15:45
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@akirattii
akirattii / background.js
Created December 2, 2016 03:45
Message passing of Chrome Extension example
/*****************************************************************
* onMessage from the extension or tab (a content script)
*****************************************************************/
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.cmd == "any command") {
sendResponse({ result: "any response from background" });
} else {
sendResponse({ result: "error", message: `Invalid 'cmd'` });
}
@rkbhochalya
rkbhochalya / optimize-images.sh
Created May 16, 2017 10:17
Recursively optimize PNG and JPEG images using convert command
# Recursively optimize PNG and JPEG images using convert command
#
# `convert` is part of ImageMagick (http://www.imagemagick.org/). You will need to install it first.
#
# Author: Rajendra Kumar Bhochalya (http://rkb.io)
#
# @see https://developers.google.com/speed/docs/insights/OptimizeImages
# Optimize all JPEG images in current directory and subdirectories
find . -name "*.jpg" -exec convert "{}" -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace RGB "{}" \; -exec echo "{}" \;