Skip to content

Instantly share code, notes, and snippets.

View gbp's full-sized avatar

Graeme Porteous gbp

View GitHub Profile
@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
@anonoz
anonoz / Dockerfile
Created March 26, 2018 03:13
Sample of multistage Dockerfile for Rails app in production
FROM madnight/docker-alpine-wkhtmltopdf as wkhtmltopdf_savior
# STAGE for bundle & yarn install
FROM ruby:2.4.3-alpine3.7 as builder
ENV CA_CERTS_PATH /etc/ssl/certs/
ENV RAILS_ENV production
ENV RAILS_LOG_TO_STDOUT true
ENV RAILS_SERVE_STATIC_FILES true
@garethrees
garethrees / pro_sample_data.rb
Last active September 28, 2022 08:53
Alaveteli Pro Sample Data – WARNING: Takes a few hours to run
require 'rspec/rails'
require 'factory_bot'
require Rails.root.join('spec', 'support', 'load_file_fixtures')
require Rails.root.join('spec', 'support', 'email_helpers')
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
end
factory_users = User.pluck(:id) - [1,2,3,4,5,6,7]
@simont77
simont77 / elgato-eve.md
Last active June 4, 2025 19:22 — forked from gomfunkel/elgato-eve.md
Elgato Eve HomeKit Services & Characteristics

Elgato Eve HomeKit Services & Characteristics

A work in progress collection of proprietary and as of yet undocumented HomeKit characteristics and their UUIDs used by Elgato Eve.

Based on the work by gomfunkel and 0ff. Characteristics and data dump for Door, Motion and Thermo thanks to @NebzHB.

More infos not yet incorporated in the comment section.

This list is not including all Eve accessories available and some services and characteristics still make no sense to me. If you have anything to contribute, please leave a comment. There is no guarantee that the information listed below is correct.

@garethrees
garethrees / rsync.sh
Last active June 2, 2025 22:02
rsync & scp through jump host
# Upload
rsync -av -e "ssh -A JUMP_HOST ssh" FILE_TO_SEND DEST_HOST:/home/gareth/
# Download
rsync -av -e "ssh -A JUMP_HOST ssh" DEST_HOST:~/FILE_TO_DOWNLOAD ~/Downloads/
@garethrees
garethrees / alaveteli-install.sh
Last active November 9, 2021 16:13
Alaveteli dev install
# Host
# ------------------------------------------------------------------------------
# Go to your main code directory
cd ~/Code
# Clone alaveteli
git clone --recursive https://github.com/mysociety/alaveteli.git
cd alaveteli
git checkout master # Or the specific version a site is running on, e.g. `0.20.0.14`
@krasnoukhov
krasnoukhov / 2013-01-07-profiling-memory-leaky-sidekiq-applications-with-ruby-2.1.md
Last active September 28, 2025 09:53
Profiling memory leaky Sidekiq applications with Ruby 2.1

My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.

As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.

I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.

So, in order to profile your worker, add this to your Sidekiq configuration:

if ENV["PROFILE"]
@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active October 24, 2025 12:44
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@pschyska
pschyska / 0_pw_hash.rb
Last active July 6, 2021 12:30
PW hashing with puppet parser function
# lib/puppet/parser/functions/pw_hash.rb
module Puppet::Parser::Functions
newfunction(:pw_hash, type: :rvalue) do |args|
raise Puppet::ParseError, "pw_hash takes exactly two arguments, #{args.length} provided" if args.length != 2
# SHA512 ($6), default number of rounds (5000)
# rounds could be specified by prepending rounds=<n>$ parameter before the salt, i.e.
# args[0].crypt("$6$rounds=50000$#{args[1]}")
args[0].crypt("$6$#{args[1]}")
end
@lfender6445
lfender6445 / gist:9919357
Last active October 8, 2025 09:24
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger