Skip to content

Instantly share code, notes, and snippets.

View imidsac's full-sized avatar

SACKO Idriss imidsac

View GitHub Profile
@imidsac
imidsac / nginxproxy.md
Created February 6, 2024 18:47 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@imidsac
imidsac / Install Odoo 12 Instructions.md
Created February 4, 2020 11:51 — forked from doopz/Install Odoo 12 Instructions.md
Install Odoo 12 on Ubuntu 18.04 with Nginx and Letscrypt

Install Odoo 12 Instructions

Update OS

sudo apt update && sudo apt upgrade
sudo apt autoremove

Install Postgress

@imidsac
imidsac / rails-jsonb-queries
Created September 28, 2019 19:47 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@imidsac
imidsac / certificate.rb
Created September 1, 2019 08:44 — forked from fnando/certificate.rb
Create PDF using Prawn
require "prawn"
class Certificate
attr_accessor :path
PDF_OPTIONS = {
:page_size => "A5",
:page_layout => :landscape,
# :background => "public/images/cert_bg.png",
:margin => [40, 75]
@imidsac
imidsac / postgres-brew.md
Created July 28, 2019 16:49 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@imidsac
imidsac / gitflow-breakdown.md
Created December 29, 2017 08:28 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@imidsac
imidsac / ubuntu_rails_install.rb
Created October 31, 2017 16:34 — forked from giver/ubuntu_rails_install.rb
Capistrano script to install Ruby, RVM, Rails in ubuntu (modified from deploy.rb scripts)
namespace :ubuntu do
desc "Setup Environment"
task :setup_env, :roles => :app do
update_apt_get
install_dev_tools
install_git
install_subversion
install_sqlite3
# Install and setup RVM instead of old Rails stack
#install_rails_stack
@imidsac
imidsac / db.rake
Created August 27, 2017 20:25 — forked from kofronpi/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
namespace :db do
DUMP_FMT = 'p' # 'c', 'p', 't', 'd'
desc 'Dumps the database to backups'
task sql_dump: :environment do
dump_sfx = suffix_for_format(DUMP_FMT)
backup_dir = backup_directory(true)
cmd = nil
with_config do |app, host, db, user|
file_name = Time.now.strftime("%Y%m%d%H%M%S") + "_" + db + '.' + dump_sfx