Skip to content

Instantly share code, notes, and snippets.

@tpitale
tpitale / README.md
Last active November 2, 2022 19:59
Sublime Text plugin to create a simple timestamp
  1. Go to Tools > New Plugin
  2. Paste timestamp.py contents and save in User as timestamp.py
  3. Open Preferences > Key Bindings - User (or Default, your call)
  4. Paste keybindings.json, or add a line to your keybindings
  5. Customize the keyboard shortcut to your liking and save
@tpitale
tpitale / db-backup.sh
Last active March 7, 2022 02:19 — forked from bkenny/db-backup.sh
Simple shell script to backup each postgresql database to s3.
#!/bin/bash
BACKUP="/tmp/s3/db"
DATE=`date +"%Y-%m-%d"`
DIR="${BACKUP}/${DATE}/"
if [ ! -d $DIR ];
then
mkdir -p $DIR
fi
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
@tpitale
tpitale / scrollbar_example.css
Created December 17, 2010 19:11
Super simple scrollbars for webkit similar to iOS
#sidebar ul.customers::-webkit-scrollbar {
width: 5px;
}
#sidebar ul.customers::-webkit-scrollbar-thumb:vertical {
margin: 5px;
background-color: #999;
-webkit-border-radius: 5px;
}
@tpitale
tpitale / czmq-test.rb
Created October 9, 2013 04:15
Celluloid-zmq PubSub messing about.
#!/usr/bin/env ruby
gem 'celluloid-zmq', '0.15.0'
require 'celluloid'
require 'celluloid/zmq'
class Publisher
include Celluloid::ZMQ
@tpitale
tpitale / feed.xml
Created March 29, 2018 21:37
Petrolicious.com Feed
<?xml version="1.0"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Petrolicious</title>
<link>https://staging.petrolicious.com</link>
<description>Petrolicious is a leading automotive lifestyle brand providing world class short films and tasteful editorial around the world&#x2019;s finest classic vehicles.</description>
<language>en-us</language>
<copyright>&#xA9; Petrolicious / May Moon Media 2018. All Rights reserved.</copyright>
<atom:link href="https://staging.petrolicious.com/feed" rel="self" type="application/rss+xml"/>
<item>
@tpitale
tpitale / svg-to-vector-pdf.sh
Last active January 6, 2018 13:48
Loop to rsvg-convert all SVG files to Vector PDF
for i in `ls *.svg`
rsvg-convert -f pdf -o PDF/${i}.pdf $i
@tpitale
tpitale / deeply_hash.rb
Created August 25, 2014 18:12
Using default proc to deeply, arbitrarily nest new Hash
# http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-default_proc-3D
h = Hash.new {|hash, key| hash[key] = Hash.new(&hash.default_proc)}
h[:foo][:bar][:baz][:bat] = "hello"
p h
#=> {:foo=>{:bar=>{:baz=>{:bat=>"hello"}}}}
import Ember from 'ember';
import Utils from 'docket/utils';
import Status from 'docket/models/status';
import User from 'docket/models/user';
export default Ember.Route.extend({
activate: function() {
this._super();
// do some setup related to event_source here
},
@tpitale
tpitale / adjust-srt.rb
Created April 19, 2017 20:37
Adjust timestamps in an SRT file
adjust_by = 48 # seconds
srt = File.read(File.expand_path("~/Downloads/EN.srt"))
new_srt = srt.
split("\r\n\r\n").
map {|s| s.split("\r\n")}.
map do |i, times, *values|
new_times = times.split(" --> ").map {|t| (Time.strptime(t, "%H:%M:%S,%L") + adjust_by).strftime("%H:%M:%S,%L")}.join(" --> ")