Skip to content

Instantly share code, notes, and snippets.

View eggbean's full-sized avatar

Jason Gomez eggbean

  • London, United Kingdom
View GitHub Profile
@dryan
dryan / pngoptimizer.py
Created September 21, 2009 20:36
Python script for batch running optipng
#!/usr/bin/env python
# requires optipng library
import os,optparse
parser = optparse.OptionParser()
parser.add_option('--file', '-f', default=False, help="The file to optimize. Omit to optimize all pngs in the current directory.")
parser.add_option('--optimization', '-o', default=7, help="The optimatization level to run. Defaults to 7.")
options,args = parser.parse_args()
@isGabe
isGabe / functions.php
Created September 19, 2012 18:11
WordPress: Auto versioning of CSS/JS files #snippet #WordPress
/*
Auto-version CSS & JS files, allowing for cache busting when these files are changed.
Place in functions.php or wherever you are enqueueing your scripts & styles
Avoids using query strings which prevent proxy caching
Adjust paths based on your theme setup. These paths work with Bones theme
*/
@Munter
Munter / optimizeimages.sh
Created May 2, 2012 12:44
Shell script to recursively optimize all image in the current directory. WARNING: THIS OVERWRITES YOUR ORIGINALS AND REMOVES METADATA!
#!/bin/sh
set -o errexit
PNGS=`find . -iname "*.png"`
JPGS=`find . -iname "*.jpg"`
TMP1="_TMP1.PNG"
TMP2="_TMP2.PNG"
echo "Optimizing PNG"
for PNG in ${PNGS}
@yevgenko
yevgenko / pastebin.sh
Created February 11, 2012 19:02
PASTEBIN.COM BASH SCRIPT – PASTE DIRECTLY FROM YOUR TERMINAL
#!/bin/bash
# Paste at Pastebin.com using command line (browsers are slow, right?)
# coder : Anil Dewani
# date : Novemeber 7, 2010
#help function
howto()
{
echo "\
Pastebin.com Bash Script \
@claylo
claylo / cf-invalidate.php
Created June 5, 2011 17:09
How to invalidate items in AWS CloudFront
<?php
/**
* Super-simple AWS CloudFront Invalidation Script
*
* Steps:
* 1. Set your AWS access_key
* 2. Set your AWS secret_key
* 3. Set your CloudFront Distribution ID
* 4. Define the batch of paths to invalidate
* 5. Run it on the command-line with: php cf-invalidate.php
@brndnmtthws
brndnmtthws / route53-to-tf.py
Last active March 2, 2023 18:43
A python script for converting existing AWS Route53 records into Terraform HCL
#!/usr/bin/env python3
#
# Copyright (c) 2020 Brenden Matthews <brenden@brndn.io> under the MIT license
# at https://opensource.org/licenses/MIT
#
# This script converts existing Route53 records into Terraform HCL. I created
# this for a one-off job. The script uses the AWS CLI to fetch Route53 info,
# and prints the corresponding TF code to stdout.
#
# Example usage:
@eodabas
eodabas / s3vim.sh
Created July 12, 2019 14:05
wrapper for editing files on s3 with vim
#!/bin/bash
print_help() {
echo -e "Usage:\n\n $0 [--profile PROFILE] [s3_url]\n"
exit 1
}
while [[ -n $1 ]];
do
if [[ $1 == "-p" ]] || [[ $1 == "--profile" ]]; then
@flynx
flynx / Windows10-PrtSc-to-App.reg
Created April 12, 2016 04:31
Remap PrintScreen button to Application (menu) button - useful for modern Lenovo ThinkPad keyboards without an Application button...
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,5d,e0,37,e0,00,00,00,00
# -*- coding: utf-8 -*-
# pylint: disable=consider-using-f-string,invalid-name,line-too-long,super-with-arguments
'''
Ranger color-scheme using `$LS_COLORS` / `dircolors`.
Originally based on: https://github.com/ranger/colorschemes/raw/a250fe866200940eb06d877a274333a2a54c34f3/ls_colors.py
Usage: copy this file to `~/.config/ranger/colorschemes'. The base color-scheme
used for non file system entries / the unfocused pane is `default`. To change it,
@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB