Skip to content

Instantly share code, notes, and snippets.

@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

#!/bin/sh
export DEBIAN_FRONTEND=noninteractive
sudo rm -rf /etc/apt/sources.list.d/mysql.list
sudo add-apt-repository -y ppa:ondrej/mysql-5.5
sudo debconf-set-selections <<< "mysql-community-server mysql-community-server/remove-data-dir boolean true"
sudo apt-get remove --purge -y mysql-client mysql-common mysql-community-client mysql-community-server mysql-server php5-mysql libmysqlclient-dev libmysqlclient18
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo -E bash -c 'apt-get -y --force-yes install mysql-server libmysqlclient-dev'
mysqladmin -u root password semaphoredb
@vielhuber
vielhuber / script.sh
Last active March 17, 2024 16:37
ffmpeg: Video convert m2ts to mp4, mp4 to webm, mp4 to ogv #tools
MP4 TO MP4 (MEDIUM)
ffmpeg -i input.mp4 -b 1000000 output.mp4
M2TS TO MP4
ffmpeg -i input.m2ts -vcodec libx264 -crf 20 -acodec ac3 -vf "yadif" output.mp4
MP4 TO WEBM (HIGH)
ffmpeg -i input.mp4 -aq 5 -ac 2 -qmax 25 -threads 2 output.webm
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -b:a 128k -c:a libopus output.webm
@smedstadc
smedstadc / read_only_hash.rb
Created April 12, 2015 23:42
Read Only Ruby Hash Snippet
# By extending a regular ruby hash with this module the hash will behave as if
# it were an immutable object. The brackets and fetch methods will return copies
# of values and the assignment method will raise an exception.
#
# Other methods that should be redefined for a truly immutable hash object.
# :delete, :delete_if, :reject!, :select!, :keep_if, :merge!, :update
module ReadOnlyHash
def [](key)
value = super(key)
value ? value.dup : default
@adamloving
adamloving / show-express-routes-gulp-task.js
Created June 9, 2014 18:23
Gulp task to show the routes in an express app (similar to rails rake routes).
var app = require('../server/app.js').create()
var gulp = require('gulp');
var task = require('./index');
/*
Output all the routes that the app supports
*/
gulp.task('routes', function() {
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@mgreenly
mgreenly / gist:1109325
Created July 27, 2011 13:11
database cleaner multiple connections single orm outside of rails
RSpec.configure do |config|
config.before(:suite) do
ActiveRecord::Base.establish_connection database['one']
DatabaseCleaner.strategy = :deletion
ActiveRecord::Base.establish_connection config.database['two']
DatabaseCleaner.strategy = :deletion
end
config.before(:each) do