Skip to content

Instantly share code, notes, and snippets.

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@osazemeu
osazemeu / readme.md
Created February 15, 2022 11:05 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

@osazemeu
osazemeu / sha256-hmac.md
Created July 26, 2021 21:52 — forked from jasny/sha256-hmac.md
Hashing examples in different languages

Example inputs:

Variable Value
key the shared secret key here
message the message to hash here

Reference outputs for example inputs above:

| Type | Hash |

@osazemeu
osazemeu / ubuntu-post-install.sh
Created May 16, 2021 18:42 — forked from rougeth/ubuntu-post-install.sh
A post-installation bash script for Ubuntu (13.10)
#!/bin/bash
#
# Ubuntu post-install script
#
# Author:
# Marco Rougeth <marco@rougeth.com>
#
# Description:
# A post-installation bash script for Ubuntu (13.10)
#
@osazemeu
osazemeu / rails-elasticbean.txt
Created June 7, 2020 11:21 — forked from mankind/rails-elasticbean.txt
Deploying a simple Rails application with AWS Elastic Beanstalk
Deploying a simple Rails application with AWS Elastic Beanstalk by Julien SIMON, Principal Technical Evangelist @ Amazon Web Services
18/02/2016
http://www.slideshare.net/JulienSIMON5/deploying-a-simple-rails-application-with-aws-elastic-beanstalk
1. . Create a Git repository with AWS CodeCommit
$ aws codecommit create-repository --repository-name blog --region us-east-1 --repository-description "ElasticBeanstalk demo"
$ git clone ssh://git-codecommit.us- east-1.amazonaws.com/v1/repos/blog
2. Create a new Rails application
@osazemeu
osazemeu / gist:4bdf00813d6bc1b31116150231cb69f2
Last active December 29, 2019 02:21 — forked from jkubacki/gist:e2dd904bd648b0bd4554
Mac uninstall elasticsearch
#!/usr/bin/env sh
# checks to see if running
launchctl list | grep elasticsearch
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl remove homebrew.mxcl.elasticsearch
pkill -f elasticsearch
@osazemeu
osazemeu / README.md
Created June 8, 2019 14:57 — forked from cohawk/README.md
CockroachDB fork of the postgrex adapter - Elixir Ecto caveats

Over the weekend I spun up a new Elixir :ecto, "2.2.7" project that I was able to get working with CockroachDB and this adapter fork - with some caveats I wanted to share to help others.

  1. Only the root user can create databases This requires you configure the Ecto.Adapters.Postgres username as root or else the mix ecto.create command will always fail. You can go back and change your configured username to something else after the database has been created, or create your database and user permissions using cockroach sql and skip the mix ecto.create command.

  2. Configuring Ecto primary_key ID to be created by CockroachDB By default when configuring your Ecto.Schema using autogenerate: false it appears either CockroachDB, Ecto or the Postrex adapter (I did not investigate this) uses the BIGINT unique_rowid() function as the default value for IDs

@primary_key {:id, :id, autogenerate:
@osazemeu
osazemeu / wp.sh
Created April 3, 2019 14:59 — forked from robertogalan/wp.sh
Shell script to install apache/mysql/php/wordpress into an EC2 instance of Amazon AMI Linux.
#! /bin/bash
# Shell script to install apache/mysql/php/wordpress into an EC2 instance of Amazon AMI Linux.
# Step 1: Create an AWS EC2 instance
# Step 2: ssh in like: ssh -v -i wordpress.pem ec2-user@ec2-54-185-74-0.us-west-2.compute.amazonaws.com
# Step 3: Run this as root/superuser, do sudo su
echo "Shell script to install apache/mysql/php/wordpress into an EC2 instance of Amazon AMI Linux."
echo "Please run as root, if you're not, choose N now and enter 'sudo su' before running the script."
echo "Run script? (y/n)"
@osazemeu
osazemeu / latency_numbers.md
Created March 2, 2019 14:26 — forked from GLMeece/latency_numbers.md
Latency Numbers Every Programmer Should Know - MarkDown Fork

Latency Comparison Numbers

Note: "Forked" from Latency Numbers Every Programmer Should Know

Event Nanoseconds Microseconds Milliseconds Comparison
L1 cache reference 0.5 - - -
Branch mispredict 5.0 - - -
L2 cache reference 7.0 - - 14x L1 cache
Mutex lock/unlock 25.0 - - -
@osazemeu
osazemeu / S3-Static-Sites.md
Created May 22, 2018 14:19 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources