Skip to content

Instantly share code, notes, and snippets.

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active March 31, 2024 18:45 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active March 27, 2024 06:33
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
@skade
skade / (slash)etc(slash)hosts
Last active January 2, 2016 02:19
Get Facebook off your internet
#ignore stupid sites
127.0.0.1 techcrunch.com
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 www.static.ak.fbcdn.net
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 fbcdn.net
@lucaong
lucaong / README.md
Last active August 29, 2015 13:56
ClosedStruct

ClosedStruct

A stupidly simple implementation of a kind of "sorta immutable" struct that can be instantiated as conveniently as an OpenStruct but after instantiation it doesn't let me (easily) add fields or mutate them:

guy = ClosedStruct.new( name: "John", age: 23 )

# readers:
guy.name             #=> "John"
guy.age #=> 23
# config/initializers/paperclip.rb
# If you want to disable paperclip attachments to S3 in the development environment,
# remove the comments from the "if" condition below and restart the server.
#if Rails.env.staging? || Rails.env.production?
Paperclip::Attachment.default_options[:storage] = :s3
Paperclip::Attachment.default_options[:s3_credentials] = {
:bucket => "app-#{Rails.env}",
:access_key_id => '<ACCESS_KEY_ID>',
:secret_access_key => '<SECRET_ACCESS_KEY>'
@rmehner
rmehner / reinstall-rubies.sh
Created April 6, 2014 14:41
Reinstalls all rbenv rubies. Keeping that here for the regular libyaml update ;-)
for ruby in ~/.rbenv/versions/*; do
rbenv uninstall -f ${ruby##*/}
rbenv install ${ruby##*/}
done
@jareware
jareware / README.md
Last active March 21, 2024 15:14
Conversion script between the TTML & SRT subtitle formats

premiere-subtitle-convert

Conversion script between the TTML & SRT subtitle formats. This is particularly useful with Adobe Premiere, as it doesn't understand the SRT format (which is joyously simple and interoperable). TTML-XML is probably the most straightforward subtitle format it does understand, hence this tool.

Note that due to the simplicity of the SRT format, this conversion is extremely lossy for all the bells and whistles supported by TTML. Not like you'd want fixed-pixel font sizes etc in your subtitles anyway, but you've been warned.

require 'rspec'
require 'set'
class Traverser
attr_reader :elements, :satisfied
def initialize(elements, satisfied:)
@elements = elements
@satisfied = satisfied
end
@fnordfish
fnordfish / vagrant.md
Last active December 9, 2019 20:01
My vagrant guidelines for happy devboxes

Very rough description on how I use [Vagrant][vagrant]. Uses some SSH magic to get easy git access to your private repos.

Host Setup

  • Use most recent version of [vagrant][vagrant].
  • Some tools and plugins:
    • [vagrant-dns][vagrant-dns] (MacOS only!) starts a local DNS Server, so that you can access your webserver with a domain name (not only an IP). After installation (vagrant plugin install vagrant-dns) run vagrant dns --install to initially setup some system configurations on your system. This will require you to enter your password once.
module Enumerable
def first_to_finish
threads = collect { |args| Thread.new { yield(args) } }
loop until done = threads.detect { |t| !t.alive? }
threads.each(&:kill)
done.value
end
end
puts [5, 3, 1, 2, 4].first_to_finish { |x| sleep x }