Skip to content

Instantly share code, notes, and snippets.

View tms-anhnguyen1's full-sized avatar

Anh Nguyen tms-anhnguyen1

View GitHub Profile
@tms-anhnguyen1
tms-anhnguyen1 / app.DockerFile
Created October 7, 2021 06:25 — forked from satendra02/app.DockerFile
docker+rails+puma+nginx+postgres (Production ready)
FROM ruby:2.3.1
# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
# Set an environment variable where the Rails app is installed to inside of Docker image:
ENV RAILS_ROOT /var/www/app_name
RUN mkdir -p $RAILS_ROOT
# Set working directory, where the commands will be ran:
[Unit]
Description=Unicorn service
After=network.target
[Service]
Type=forking
Environment=RAILS_ENV=production
WorkingDirectory=/home/admin33/admin/current
User=admin33
Group=sudo
@tms-anhnguyen1
tms-anhnguyen1 / sysctl.conf
Created September 23, 2021 12:56 — forked from JoeyBurzynski/sysctl.conf
sysctl.conf Optimization / Ubuntu 18.04
# Kernel sysctl configuration file for Linux
#
# Version 1.14 - 2019-04-05
# Michiel Klaver - IT Professional
# http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
#
# This file should be saved as /etc/sysctl.conf and can be activated using the command:
# sysctl -e -p /etc/sysctl.conf
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and sysctl.conf(5) for more details.
@tms-anhnguyen1
tms-anhnguyen1 / puma.service
Last active November 12, 2021 06:47
Systemd, Puma
[Unit]
Description=Unicorn service
After=network.target
[Service]
Type=simple
Environment=RAILS_ENV=production
WorkingDirectory=/home/creator/creator/current
User=creator
#Group=sudo
@tms-anhnguyen1
tms-anhnguyen1 / rails_db_migrate.sh
Created July 22, 2021 04:15 — forked from igorescobar/rails_db_migrate.sh
The correct way to run rails db migration on AWS Beanstalk (Docker Container Environment)
#!/bin/bash
# .ebextensions/scripts/db_migrate.sh
. /opt/elasticbeanstalk/hooks/common.sh
EB_SUPPORT_FILES=$(/opt/elasticbeanstalk/bin/get-config container -k support_files_dir)
EB_CONFIG_DOCKER_ENV_ARGS=()
while read -r ENV_VAR; do
EB_CONFIG_DOCKER_ENV_ARGS+=(--env "$ENV_VAR")
@tms-anhnguyen1
tms-anhnguyen1 / application.rb
Created March 1, 2021 10:42 — forked from basti/application.rb
Local Rails 4 assets precompilation using Capistrano 3 and rsync
# Speed things up by not loading Rails env
config.assets.initialize_on_precompile = false
const INFURA_PROJECT_ID='4e3db7a654d5445ab1cbcbd84f1f6cec';
const ADDRESS_SENDER='0x00844B09913bA9D966Bf1908cb6beEEDD823fD7D';
const PRIVATE_KEY_SENDER='993d5fc773726fc8fefb3491e775ae0e9a5d8e97c22f4d5dbef7d77f6f341e9b';
const ADDRESS_RECEIVE='0x65542a881D4b04aD6C2d02C217677affC95B9050';
const Web3 = require('web3');
const Tx = require('ethereumjs-tx').Transaction;
const web3 = new Web3(new Web3.providers.HttpProvider('https://ropsten.infura.io/v3/' + INFURA_PROJECT_ID))
var privateKey = new Buffer(PRIVATE_KEY_SENDER, 'hex')
@tms-anhnguyen1
tms-anhnguyen1 / gist:289bff4303c49f632f03c018eb1570ec
Created May 12, 2020 05:53 — forked from jordandm/gist:1879573
yum install of libxml-devel and libxslt-devel on broken node
$ sudo yum install libxml2-devel
Loaded plugins: fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
amzn-main | 2.1 kB 00:00
amzn-updates | 2.3 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package libxml2-devel.x86_64 0:2.7.6-4.11.amzn1 set to be updated
--> Processing Dependency: pkgconfig for package: libxml2-devel-2.7.6-4.11.amzn1.x86_64
@tms-anhnguyen1
tms-anhnguyen1 / install.sh
Created April 21, 2020 06:53 — forked from jobsamuel/install.sh
Install MongoDB 3.0 in Ubuntu 14.04 LTS
#!/bin/bash
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org=3.0.0 mongodb-org-server=3.0.0 mongodb-org-shell=3.0.0 mongodb-org-mongos=3.0.0 mongodb-org-tools=3.0.0
sudo service mongod start
@tms-anhnguyen1
tms-anhnguyen1 / rubocop-changed
Created March 23, 2020 06:02 — forked from dazza-codes/rubocop-changed
Run rubocop on files changed in git repository
#!/bin/bash
# check modified (M) ruby (.rb) files with rubocop
git status --porcelain | grep '^ M.*.rb' | cut -c4- | xargs -r rubocop