Skip to content

Instantly share code, notes, and snippets.

View aditiamahdar's full-sized avatar
🏠
Working from home

Aditia Mahdar aditiamahdar

🏠
Working from home
View GitHub Profile
@aditiamahdar
aditiamahdar / puma.service
Created April 4, 2025 13:41
Systemd file service to autostart rails puma app
# Steps:
# Create service file in /etc/systemd/system/puma.service
# Reload systemd: systemctl daemon-reexec && systemctl daemon-reload
# Enable service: systemctl enable puma.service
# Start service: systemctl start puma.service
# Check status: systemctl status puma.service
# See service content: systemctl cat puma.service
# Restart service (if updated): systemctl restart puma.service
[Unit]
@aditiamahdar
aditiamahdar / conventional-comments.md
Created October 23, 2024 08:10 — forked from pauloportella/conventional-comments.md
How to setup conventional comments on Github

Conventional comments

Source

You can add all conventional comments Labels to Github as a saved replies by following the following steps:

  1. Go to https://github.com/settings/replies
  2. Open Developer Tools
  3. Copy/Paste above code in JavaScript console
  4. Press enter
@aditiamahdar
aditiamahdar / find_replace.sh
Last active February 27, 2024 07:28
Find and replace string in a directory using Perl
# <UPDATE_THIS> to [UPDATE_THIS]
find DIR -type f -exec perl -pi -e 's/(<)([A-Z]{1}[a-zA-Z]*_+[a-zA-Z_]*)(>)/[$2]/g' {} +
# <[UPDATE_THIS]_STRING> to [[UPDATE_THIS]_STRING]
find DIR -type f -exec perl -pi -e 's/(<)([A-Z\[]{1}[a-zA-Z\[\]]*_+[a-zA-Z_\[\]]*)(>)/[$2]/g' {} +
# <AS3_REGION> to [AS3_REGION]
find DIR -type f -exec perl -pi -e 's/(<)([A-Z\d\[]{1}[a-zA-Z\d\[\]]*_+[a-zA-Z_\d\[\]]*)(>)/[$2]/g' {} +
# <[Evri_GB_client_name]_CA_[QA Team_AU_[QA Team_GB_[QA Team_HK_[QA Team_NL_[QA Team_SG_[QA Team_US_[IMPACT_PASSWORD]]]]]]]>
@aditiamahdar
aditiamahdar / laravel-server-setup.md
Created September 10, 2022 12:10
Laravel Server Setup

Server Setup:

  • Install composer
  • composer require --dev deployer/deployer
  • vendor/bin/dep init
  • Setup Ubuntu LTS server
  • Setup swap
  • Create deploy user add to sudo group and remove password for sudo command
  • Setup ssh key access (ssh without password)
  • Generate new ssh key for deploy user
  • Install nodejs LTS version
@aditiamahdar
aditiamahdar / installing-ruby-2.5.0-on-m1.md
Last active July 11, 2022 18:31 — forked from MarkBennett/installing-ruby-2.5.1-on-m1.md
Installing Ruby 2.5.0 on Mac M1

Install readline and openssl with standard brew install.

brew install readline
brew install openssl@1.1

Set openssl env in ~/.zshrc..

@aditiamahdar
aditiamahdar / rails-5-6-ubuntu-mina-puma-nginx.md
Created December 9, 2021 19:20 — forked from wafiq/rails-5-6-ubuntu-mina-puma-nginx.md
How to deploy Rails 5/6 in Ubuntu VM using Mina deployment with Puma webserver and Nginx

Rails 5 and 6 Deployment with Ubuntu, Mina, Puma and Nginx

Based on this tutorial but simplified and inlined. Particularly removed any Rails and 3rd party services part, assumed you just need deployment to any Ubuntu machine.

Prerequisite

  1. A functional Rails app
  2. Hosted Git repository (Github, Bitbucket, Gitlab)
  3. Cloud hosting account (Digital Ocean, Vultr, Linode, Lightsail)
  4. Local SSH account
@aditiamahdar
aditiamahdar / http_server.rb
Created February 16, 2017 08:15
30 lines HTTP Server in Ruby
# http_server.rb
require 'socket'
require 'rack'
require 'rack/lobster'
app = Rack::Lobster.new
server = TCPServer.new 5678
while session = server.accept
request = session.gets
@aditiamahdar
aditiamahdar / business.rb
Last active February 16, 2017 08:17
Sample of MongoDB Model (Pasta Code)
class Business
include Hashable
include Stateable
include Regexable
include Mongoid::Document
include Mongoid::Timestamps
include AASM
using StringRefinements
@aditiamahdar
aditiamahdar / Searchkick Word Middle
Created November 27, 2014 03:31
How to use :word_middle in searchkick
# Searchkick configuration
searchkick word_middle: [
:name, :your_fields
],
word_start: [
:name, :your_fields
]
# Search
fields = [