Skip to content

Instantly share code, notes, and snippets.

View maxim's full-sized avatar
🛠️

Max Chernyak maxim

🛠️
View GitHub Profile
@ericentin
ericentin / migrate.sh
Last active October 9, 2023 09:28
How to run Ecto migrations from an exrm release
./bin/turbo rpc Elixir.Ecto.Storage up "['Elixir.Turbo.Repo']."
./bin/my_app rpc Elixir.Mix.Ecto migrations_path "['Elixir.MyApp.Repo']."
# => <<"/opt/my_app/production/rel/my_app/lib/my_app-0.0.1/priv/repo/migrations">>
./bin/my_app rpc Elixir.Ecto.Migrator run "['Elixir.MyApp.Repo', <<\"/opt/my_app/production/rel/my_app/lib/my_app-0.0.1/priv/repo/migrations\">>, up, [{all, true}]]."
# => []
@mbbx6spp
mbbx6spp / prepare-boot-drive-from-iso
Last active February 10, 2016 00:47
Prepare bootable (USB) drive on OS X. I validated this script on a Retina MBP running Yosemite.
#!/usr/bin/env bash
# Purpose: To create a bootable (USB) drive on OSX
# Note: For a NixOS 14.12 ISO (~330MB) to a 512MB USB drive, the last step (rsync) took over 3 minutes.
declare -r platform="$(uname -s)"
if [ "${platform}" != "Darwin" ]; then
>&2 echo "Error: This will not run on ${platform} (anything other than Darwin."
exit 1
fi
@pnc
pnc / observer.md
Last active September 9, 2023 23:32
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
Problem AWS DigitalOcean
Network isolation Private Cloud/Security Groups tinc / n2n / freelan
Node initialization CloudInit/User Data ?
Node discovery EC2 API Serf
Pull app on scale More Like This Serf
Distributed config etcd etcd
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

// create new card
$('.js-add-list-popover').click();
var d = new Date();
var year = (d.getFullYear()+'').substring(2);
var month = d.getMonth() + 1;
var day = d.getDate();
var cardName = 'Published (' + month + '-' + day + '-' + year + ')';
$('.js-list-name').val(cardName);
@juliepagano
juliepagano / 101_off_limits.md
Last active December 16, 2020 09:37
101 conversations I generally don't want to have...

This list now exists over at http://juliepagano.com/blog/2013/11/02/101-off-limits/ and will be updated there.

I keep saying that impromptu, unwanted feminism 101 discussions are exhausting and not a good use of my resources. Then people ask what I mean by 101, so I'm starting to make a list. This list will change over time - I recommend checking back.

I highly recommend checking this list before engaging with me about feminism if you're new to it. It'll save both of us a lot of time and frustration.

Diversity in tech

Women aren't equally represented in tech because biology

Nope. This argument is bad and the science does not support it. Unfortunately, every time you say this out loud, you are contributing to cultural problems that do decrease the number of women in tech.

@ankane
ankane / README.md
Last active December 14, 2015 03:39 — forked from panthomakos/benchmark.rb

Benchmark Bundler

Because loading gems can take longer than you think

Now available as a gem - get it here

Development box installation guide

This guide will show how to setup a VirtualBox similiar to an Ubuntu 12.04.1 server for use with Amazon EC2.

Covered in this guide:

  • VeeWee: Tool for building base boxes which will be used by vagrant
  • Vagrant: Tool for managing virtual machines with an easy to use CLI
  • Librarian: Bundler for chef cookbooks
  • Chef-solo & Knife solo: Tool for automating installing and management of servers
@coldnebo
coldnebo / rails_trace.rb
Last active December 1, 2018 08:10
This Rack middleware for Rails3 lets you see a call-trace of the lines of ruby code in your application invoked during a single request. Only code within your app is considered (i.e. in the /app folder). This expands on my previous attempt (https://gist.github.com/3077744). Example of output in comments below.
require 'singleton'
# outputs a colored call-trace graph to the Rails logger of the lines of ruby code
# invoked during a single request.
#
# Example:
#
# 1) Make sure this file is loaded in an initializer
#
# 2) Add the following to your application.rb in Rails3: