Skip to content

Instantly share code, notes, and snippets.

@bradland
bradland / gs_data_updater.js
Created November 7, 2017 16:01
Updates data URL from named range.
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu('Data Mgmt')
.addItem('Refresh Pipeline Data', 'getData')
.addToUi();
}
function getData() {
// 'Data Import' sheet uses IMPORTDATA() function to pull CSV data from Pipeline application. This function
// only updates once an hour by default. This formula is used to alter the import URL so that the function
@bradland
bradland / Rakefile
Created March 1, 2012 21:21
Rake default lists tasks
desc "The default task; lists tasks"
task :default do
puts `rake --tasks`
end
desc "Go ahead, you deserve it"
task :endulge do
puts "You're great. You really are."
end
lap_time throttle mph rpm gear hg fg
172264 1.00 27.66 3139.65 2 -0.04 0.52
172280 1.00 27.86 3161.41 2 -0.04 0.57
172296 1.00 28.06 3177.08 2 -0.04 0.59
172316 1.00 28.32 3205.00 2 -0.03 0.60
172332 1.00 28.53 3229.73 2 -0.01 0.60
172348 1.00 28.74 3254.50 2 0.00 0.62
172364 1.00 28.95 3279.07 2 0.01 0.61
172384 1.00 29.23 3310.62 2 0.03 0.61
172396 1.00 29.39 3331.57 2 0.03 0.63
#!/bin/bash
# argument one is the input base file name
#ffmpeg -i $1.flv -vcodec png -vframes 1 -ss 00:00:$2 -an -f rawvideo -s 640x480 $1-640x480.png
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=15 > out.gif

Secure Password Generation with OpenSSL

In an excellent write-up on [using Chef to provision a Rails/Postgres server][chefwriteup], I ran across this a [code comment][deployuser] with a suggested use of OpenSSL:

    {
      "id": "deploy",
      // generate this with: openssl passwd -1 "plaintextpassword"
      "password": "",
      // the below should contain a list of ssh public keys which should

// be able to login as deploy

@bradland
bradland / sub.js
Last active December 27, 2015 18:49 — forked from jiaaro/sub.js
javascript:function replace(e){e=e.replace(/witnesses/gi,"dudes I know");e=e.replace(/allegedly/gi,"kinda probably");e=e.replace(/new study/gi,"tumblr post");e=e.replace(/rebuild/gi,"avenge");e=e.replace(/space/gi,"spaaace");e=e.replace(/google glass/gi,"virtual boy");e=e.replace(/smartphone/gi,"pokédex");e=e.replace(/electric/gi,"atomic");e=e.replace(/senator/gi,"elf-lord");e=e.replace(/car/gi,"cat");e=e.replace(/election/gi,"eating contest");e=e.replace(/congressional leaders/gi,"river spirits");e=e.replace(/homeland security/gi,"homestar runner");e=e.replace(/could not be reached for comment/gi,"is guilty and everyone knows it");return e}function replace_all_on_page(){function e(t){if(t.childNodes.length>0)for(var n=0;n<t.childNodes.length;n++)e(t.childNodes[n]);if(t.nodeType==Node.TEXT_NODE){window.el=t;t.textContent=replace(t.textContent)}}var t=document.getElementsByTagName("html")[0];e(t)}replace_all_on_page()
require 'google_drive'
require 'yaml'
require 'app_support'
require 'fileutils'
module DocCache
class Package < Struct.new(:name, :rows, :ws, :version, :created_at)
include AppSupport::Inflector
VERSION = '1.0.0'
DATA_DIR = File.join(Sinatra::Application::settings.root, 'data')
@bradland
bradland / whatismyip.rb
Last active December 27, 2015 14:59
Tells you your IP address and a xip.io address to the same for common Ruby app server ports
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'fileutils'
class App
# The website configured for this constant should serve text/plain with
# nothing but the IP address. Feel free to substitute your own.
IP_URL = 'http://wtfismyip.com/text'
@bradland
bradland / fancy_ps1.sh
Created October 18, 2013 15:09
Add this to your profile (.bashrc or .bash_profile).
########
# BEGIN PS1
# Sexy Solarized Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Screenshot: http://img.gf3.ca/d54942f474256ec26a49893681c49b5a.png
if tput setaf 1 &> /dev/null; then
tput sgr0
if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
BASE03=$(tput setaf 234)
@bradland
bradland / install_ruby.sh
Last active December 24, 2015 20:59
A reasonable Ruby install script. Includes "essential" deps.
# This build script will build Ruby 2.0.0-p247. You will need su to
# root or sudo as required.
# This build tested against Debian 7.0 64-bit arch, installed from net-inst image.
# These aren't specifically Ruby deps; more for building software in general
# (you probably already have them)
apt-get install -y build-essential autoconf
# These deps will support common libraries like yaml and give you the best irb experience.