Skip to content

Instantly share code, notes, and snippets.

View aaroncaito's full-sized avatar

Aaron Caito aaroncaito

View GitHub Profile
#!/bin/sh
# Install Homebrew
which brew > /dev/null 2>&1
if [ $? -eq 1 ]; then
#Cheat, if we don't have brew, install xcode command line utils too
xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
else
@monkut
monkut / argparse_date_datetime_custom_types.py
Last active May 10, 2023 15:47
Custom date/datetime type validators for python's argparse module
def valid_date_type(arg_date_str):
"""custom argparse *date* type for user dates values given from the command line"""
try:
return datetime.datetime.strptime(arg_date_str, "%Y-%m-%d")
except ValueError:
msg = "Given Date ({0}) not valid! Expected format, YYYY-MM-DD!".format(arg_date_str)
raise argparse.ArgumentTypeError(msg)
def valid_datetime_type(arg_datetime_str):
"""custom argparse type for user datetime values given from the command line"""
@SlexAxton
SlexAxton / .zshrc
Last active April 25, 2023 03:57
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active September 8, 2024 11:59
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@cemkozinoglu
cemkozinoglu / twitter.html
Created June 29, 2011 18:51
My Solution for Twitter
<!-- dont forget to include jQuery -->
{% if account.provider == 'twitter' %}
<script type="text/javascript">
$(function(){
$.ajax({
url : "http://api.twitter.com/1/users/show.json?user_id={{ account.uid }}",
dataType : "jsonp",