This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'zlib' | |
| require 'stringio' | |
| require 'json' | |
| def gunzip(data) | |
| io = StringIO.new(data, "rb") | |
| gz = Zlib::GzipReader.new(io) | |
| decompressed = gz.read | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function currentTimezoneOffset() { | |
| var dstPeriod = { | |
| 2012: [new Date(2012, 2, 11), new Date(2012, 10, 4)], | |
| 2013: [new Date(2013, 2, 10), new Date(2013, 10, 3)], | |
| 2014: [new Date(2014, 2, 9), new Date(2014, 10, 2)], | |
| 2015: [new Date(2015, 2, 8), new Date(2015, 10, 1)], | |
| 2016: [new Date(2016, 2, 13), new Date(2016, 10, 6)], | |
| 2017: [new Date(2017, 2, 12), new Date(2017, 10, 5)], | |
| 2018: [new Date(2018, 2, 11), new Date(2018, 10, 4)], | |
| 2019: [new Date(2019, 2, 10), new Date(2019, 10, 3)], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Update our package manager... | |
| sudo apt-get update | |
| # Install dependencies for RVM and Ruby... | |
| sudo apt-get install -y build-essential libxslt1-dev libxml2-dev libreadline-dev zlib1g-dev libssl-dev curl git-core | |
| # Get and install RVM | |
| curl -L https://get.rvm.io | sudo bash -s stable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "rvm/capistrano" | |
| ... | |
| namespace :bootstrap do | |
| task :default do | |
| # Specific RVM string for managing Puppet; may or may not match the RVM string for the application | |
| set :user, "ubuntu" | |
| # Set the default_shell to "bash" so that we don't use the RVM shell which isn't installed yet... | |
| set :default_shell, "bash" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Credentials for a MySQL user with PROCESS, SUPER permissions | |
| USERNAME= | |
| PASSWORD= | |
| # MySQL Server location | |
| HOST=127.0.0.1 | |
| PORT=3306 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| CHARACTERS = (('A'..'Z').to_a + ('a'..'z').to_a + (0..9).to_a) | |
| GROUP = 53 | |
| MY_MACHINE_DYNDNS_ADDRESS = "Put your DynDns DNS name here" | |
| MY_SSH_PORT = "Your router's external port that will forward to SSH" # as a Fixnum | |
| def ridiculous_password | |
| (1..20).map do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "openssl" | |
| require "digest" | |
| def aes128_cbc_encrypt(key, data, iv) | |
| key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize) | |
| iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize) | |
| aes = OpenSSL::Cipher.new('AES-128-CBC') | |
| aes.encrypt | |
| aes.key = key | |
| aes.iv = iv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # minimal rails3 app | |
| require 'action_controller' | |
| Router = ActionDispatch::Routing::RouteSet.new | |
| Router.draw do | |
| root :to => 'site#index' | |
| end | |
| class SiteController < ActionController::Metal |