Skip to content

Instantly share code, notes, and snippets.

View fidalgo's full-sized avatar
🐧

Paulo Fidalgo fidalgo

🐧
View GitHub Profile
@hopsoft
hopsoft / Dockerfile
Last active May 17, 2023 19:58
Dockerize your Rails app
FROM ruby:3.0-alpine
RUN apk add --no-cache --update \
ack \
bash \
build-base \
curl \
git \
htop \
less \
@DmitryTsepelev
DmitryTsepelev / change_column_type.rb
Created August 27, 2020 08:46
How to change column type (e.g., int -> bigint) without downtime
ActiveRecord::Migration.remove_foreign_key(:current_table, :foreign_table) # no lock
ActiveRecord::Migration.add_column(:current_table, :column_bigint, :bigint) # no lock
copy_data = lambda do
CurrentTable.where(column_bigint: nil).where.not(column: nil).in_batches do |batch|
batch.update_all("column_bigint = column")
end
end
@nhira
nhira / workspaces-linux-client-rpm.md
Last active February 10, 2024 13:35
How to install Amazon Workspaces Linux Client for Fedora

Amazon WorkSpaces Linux client - RPM installation

Overview

The good news is that there is an Amazon WorkSpaces Linux client. If you happen to use Ubuntu, you can use the official instructions from the documentation. But what if you're on an rpm-friendly distribution like Fedora or CentOS?

alien to the rescue.

How to

You can use these steps to build a PCoIP client (not the 2023 WSP client) RPM from the original .deb package.

@SunDi3yansyah
SunDi3yansyah / find_duplicate.rb
Last active October 1, 2021 14:06
Rails find duplicate records
columns_that_make_record_distinct = [:some_attribute]
distinct_ids = Model.select("MIN(id) as id").group(columns_that_make_record_distinct).map(&:id)
duplicate_records = Model.where.not(id: distinct_ids)