Skip to content

Instantly share code, notes, and snippets.

View nightcrawler-'s full-sized avatar

Frederick Nyawaya nightcrawler-

View GitHub Profile
@nightcrawler-
nightcrawler- / deduplicate.sh
Created March 3, 2023 02:26
deduplicate .zsh_history
awk '!a[$0]++' ~/.zsh_history > ~/.zsh_history_new && mv ~/.zsh_history_new ~/.zsh_history
# This command reads the current Zsh history file (~/.zsh_history),
# removes duplicates using awk, saves the unique commands to a new file (~/.zsh_history_new),
# and finally replaces the old history file with the new one.
# After running this command, you should have a Zsh history file without any duplicates.

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@nightcrawler-
nightcrawler- / ruby_on_rails_deployment.md
Created January 19, 2023 20:56 — forked from zentetsukenz/ruby_on_rails_deployment.md
Deploy Ruby on Rails application with Docker Compose and Capistrano with ease

Docker

Files and Folders.

|
|\_ app
|...
|\_ docker
| |
@nightcrawler-
nightcrawler- / rspec_model_testing_template.rb
Created July 9, 2022 21:45 — forked from kimroen/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@nightcrawler-
nightcrawler- / linux_fun.md
Created February 4, 2022 23:05 — forked from zlorb/linux_fun.md
How to have some fun using the terminal.

Linux fun-o-matic

How to have some fun using the terminal.

  1. Install cowsay [0] via : sudo apt-get install cowsay
  2. Install fortune [1] via : sudo apt-get install fortune
  3. Install figlet [3] via : sudo apt-get install figlet
  4. Make sure you have Ruby installed via : ruby -v
  5. Install the lolcat [2] via : gem gem install lolcat
  6. (option) Add to .bash_profile and/or .bashrc
# frozen_string_literal: true
# == Schema Information
#
# Table name: contributions
#
# id :bigint not null, primary key
# aasm_state :string
# amount :integer default(0)
# error_message :string
# frozen_string_literal: true
# == Schema Information
#
# Table name: contributions
#
# id :bigint not null, primary key
# aasm_state :string
# amount :integer default(0)
# error_message :string
# frozen_string_literal: true
class ContributionsController < ApplicationController
skip_before_action :authenticate_user!, only: %i[new create show] # Allow the new contributions page to be accessible without sign in: for sharing OGP data, search engine indexing etc. Also allow create, so no regostration required to contribute, jst phone number
before_action :set_contribution, only: %i[show edit update destroy]
before_action :set_campaign, only: %i[new create]
# GET /contributions
# GET /contributions.json
@nightcrawler-
nightcrawler- / application-properties.md
Created October 26, 2021 16:17 — forked from geunho/application-properties.md
spring-kafka application.properties

https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html spring.kafka prefixed properties

Key Default Value Description
spring.kafka.admin.client-id ID to pass to the server when making requests. Used for server-side logging.
spring.kafka.admin.fail-fast false Whether to fail fast if the broker is not available on startup.
spring.kafka.admin.properties.* Additional admin-specific properties used to configure the client.
spring.kafka.admin.ssl.key-password Password of the private key in the key store file.
spring.kafka.admin.ssl.key-store-location Location of the key store file.
@nightcrawler-
nightcrawler- / reposize.sh
Created October 15, 2021 18:43
View size of repo before cloning
curl https://api.github.com/repos/google/iosched 2> /dev/null | grep size | tr -dc '[:digit:]'