Skip to content

Instantly share code, notes, and snippets.

View rajraj's full-sized avatar

Rajesh Rajappan rajraj

View GitHub Profile
@dhh
dhh / linux-setup.sh
Last active May 8, 2024 08:08
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils

How to deploy a Rails 7.1 app with Postgres and Kamal on a single server

I think you have looked at the tutorial from Mr. Heinemeier Hansson at least once or twice and have a similar setup.

rails new kamal_pg --css tailwind --skip-test --database=postgresql

cd kamal_pg
@Austex
Austex / Capfile
Last active May 28, 2019 15:53
Capistrano deploy webpacker:install error - Webpack binstubs not found. Have you run rails webpacker:install ?
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git
@mwickett
mwickett / formikApollo.js
Last active December 20, 2022 23:00
Formik + Apollo
import React from 'react'
import { withRouter, Link } from 'react-router-dom'
import { graphql, compose } from 'react-apollo'
import { Formik } from 'formik'
import Yup from 'yup'
import FormWideError from '../elements/form/FormWideError'
import TextInput from '../elements/form/TextInput'
import Button from '../elements/form/Button'
import { H2 } from '../elements/text/Headings'
@mbenatti
mbenatti / 0-font-awesome-bootstap-phoenix.md
Last active February 2, 2024 14:59
Installing Bootstrap 4 + Font Awesome from NPM in Phoenix Framework using sass
  • Tested with Phoenix 1.3

1) Installing sass, font-awesome and bootstrap package's using Brunch

First, install the Sass, Font Awesome, bootstrap(and deps) package:

cd assets

  • npm install --save-dev sass-brunch
  • npm install --save font-awesome
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require File.dirname(__FILE__) + '/blueprints'
require 'faker'
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
class MiniTest::Unit::TestCase
include MiniTest::ActiveRecordAssertions
@huskercane
huskercane / ruby_sffp_ssh_key.rb
Last active October 20, 2021 00:13
Use ruby net-sftp or net-ssh with private key authentication
require 'net/sftp'
SERVER = "127.0.0.0"
KEY_FILE = "/tmp/id_rsa"
Net::SFTP.start(SERVER, 'huskercane', :keys=>[KEY_FILE]) do |sftp|
sftp.mkdir! "/tmp/something"
#thats right needs full file name to copy
sftp.upload!("/tmp/something/something.txt", "/tmp/something/something.txt")
end
@rajraj
rajraj / sublime_keybinings
Last active October 11, 2015 14:08
Sublime Text Keybinings
[
{ "keys": ["ctrl+shift+z"], "command": "insert_snippet", "args": {"contents": "<%= ${0:$TM_SELECTED_TEXT} %>"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html, source.yaml, meta.erb" }
]
},
{ "keys": ["ctrl+alt+x"], "command": "insert_snippet", "args": {"contents": "<% ${0:$TM_SELECTED_TEXT} %>"}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "text.html, source.yaml, meta.erb" }
]
@rajraj
rajraj / .bash_profile
Created March 29, 2012 07:25 — forked from henrik/.bashrc
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
# Edit .bash_profile
$ nano ~/.bash_profile
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
@rajraj
rajraj / gist:1834639
Created February 15, 2012 09:13
Backup and Restore MySql Database
# Backup Mysql database
$ mysqldump -u root -p contracts_production > contracts.sql
# Restore Mysql database from sql file
$ mysql -u root -p contracts_production < contracts.sql