Skip to content

Instantly share code, notes, and snippets.

View progapandist's full-sized avatar

Andy Baranov progapandist

View GitHub Profile
@so0k
so0k / kubectl.md
Last active February 4, 2025 17:16
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
require 'cucumber'
require 'selenium-webdriver'
# require 'cukehub' # optional, but recommended. See cukehub.com for more details
caps = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { binary: "/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary",
args: [ "--headless" ]})
Before do
@browser = Selenium::WebDriver.for :chrome, desired_capabilities: caps
end
@pel-daniel
pel-daniel / cheatsheet.md
Last active September 11, 2017 20:37
Rails conventions

Rails conventions

General

All filenames are in snake_case following the same conventions

  • Model: singular (e.g. Restaurant)
  • Controller: plural (e.g. RestaurantsController)
  • Table in DB: plural (e.g. restaurants)
  • URL's: all in plural (e.g. /restaurants, /restaurants/:id, /restaurants/new)
@ricjcosme
ricjcosme / dump-restore
Created September 13, 2017 17:33
DUMP / RESTORE PostgreSQL Kubernetes
DUMP
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
kubectl exec [pod-name] -- bash -c "pg_dump -U [postgres-user] [database-name]" > database.sql
RESTORE
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
@matthewpalmer
matthewpalmer / pod.yaml
Last active April 24, 2024 00:00
Example Kubernetes pod for the multi-container sidecar design pattern
# Example YAML configuration for the sidecar pattern.
# It defines a main application container which writes
# the current date to a log file every five seconds.
# The sidecar container is nginx serving that log file.
# (In practice, your sidecar is likely to be a log collection
# container that uploads to external storage.)
# To run:
@db0sch
db0sch / regenerate_credentials.md
Last active July 30, 2024 12:59
How to regenerate the master key for Rails 5.2 credentials

If your master.key has been compromised, you might want to regenerate it.

No key regeneration feature at the moment. We have to do it manually.

  1. Copy content of original credentials rails credentials:show somewhere temporarily.
  2. Remove config/master.key and config/credentials.yml.enc
  3. Run EDITOR=vim rails credentials:edit in the terminal: This command will create a new master.key and credentials.yml.enc if they do not exist.
  4. Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
  5. Add and Commit the file config/credentials.yml.enc
@palkan
palkan / Dockefile
Last active May 14, 2020 06:09
hybrid dockerfile
ARG RUBY_VERSION
# === Base image ===
FROM ruby:${RUBY_VERSION}-slim-buster as base
ARG NODE_MAJOR
ARG POSTGRES_VERSION
ARG BUNDLER_VERSION
ARG YARN_VERSION
# Common dependencies
@YasuhiroYoshida
YasuhiroYoshida / Dockerfile
Last active April 14, 2021 12:08
Dockerfile for a Rails project with Ruby 2.7.1 with jemalloc built on Debian 10 (USER ≠ root)
FROM debian:buster-slim
ARG RUBY_VERSION=2.7.1-jemalloc
# RUN with pipe recommendation: https://github.com/hadolint/hadolint/wiki/DL4006
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update -q \
&& apt-get dist-upgrade --assume-yes \
&& apt-get install --assume-yes -q --no-install-recommends \
curl \