Skip to content

Instantly share code, notes, and snippets.

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

Gaurav Sharma Gaurav2728

🏠
Working from home
View GitHub Profile
@Gaurav2728
Gaurav2728 / test.md
Last active December 10, 2018 10:49

Print-friendly Assignment

Instructions:

  • Use gitlab private repositories for code and add https://gitlab.com/manu_j as collaborator. Email manu@printfriendly.com once finished.
  • You can use a webhook testing platform instead of slack but it should follow the slack webhook payload format.

Coding Challenge:

Create a ruby web application, which accepts webhook requests from github.

@Gaurav2728
Gaurav2728 / MySQL_5-7_macOS.md
Created December 6, 2018 08:18 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Keybase proof

I hereby claim:

  • I am gaurav2728 on github.
  • I am gaurav2728 (https://keybase.io/gaurav2728) on keybase.
  • I have a public key ASBBEQN2hrMTS5LRF_x76wLLJPALDOW5Bh6cRjtPM4hgXQo

To claim this, I am signing this object:

@Gaurav2728
Gaurav2728 / notify_slack.rb
Created May 17, 2018 16:12 — forked from seancdavis/notify_slack.rb
Post incoming webhook to Slack using Ruby
# Assumes:
# - curl is installed
# - you have a slack channel with an incoming webhook configured
require 'json'
def notify_slack(webhook_url, channel, username, text, image)
payload = {
:channel => channel,
:username => username,
@Gaurav2728
Gaurav2728 / psqlfix.txt
Created January 25, 2018 16:51
Change postgres default template0 to UTF8 encoding
mike@rbci:~$ psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1

Typing vagrant from the command line will display a list of all available commands.

Be sure that you are in the same directory as the Vagrantfile when running these commands!

Creating a VM

  • vagrant init -- Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
  • vagrant init <boxpath> -- Initialize Vagrant with a specific box. To find a box, go to the public Vagrant box catalog. When you find one you like, just replace it's name with boxpath. For example, vagrant init ubuntu/trusty64.

Starting a VM

  • vagrant up -- starts vagrant environment (also provisions only on the FIRST vagrant up)
@Gaurav2728
Gaurav2728 / lets-encrypt-nginx.md
Created June 4, 2017 12:05 — forked from padde/lets-encrypt-nginx.md
Let's Encrypt with Nginx

Let's Encrypt with Nginx

Here's how I set up a tiny Nginx/Rails server that uses HTTPS via a Let's Encrypt issued certificate.

https://letsencrypt.paddd.de/

Server

I use the smallest DigitalOcean droplet (512 MB) here, which is built from the "Ubuntu Ruby on Rails on 14.04" image provided by them.

@Gaurav2728
Gaurav2728 / ml-ruby.md
Created May 9, 2016 07:59 — forked from gbuesing/ml-ruby.md
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby

Gems

require 'test_helper'
class RedemptionCodeTest < ActiveSupport::TestCase
def setup
@business = businesses :vinovolo
@business.enabled_reward_back = true
@user = users :warren
@user.punchh_app = punchh_apps :vinovolo
end
@Gaurav2728
Gaurav2728 / VdbeIntExtract.h
Created October 20, 2012 06:36 — forked from mattrco/VdbeIntExtract.h
Selected attributes of struct Vdbe from VdbeInt.h
struct Vdbe {
sqlite3 *db; /* The database connection that owns this statement */
Op *aOp; /* Space to hold the virtual machine's program */
Mem *aMem; /* The memory locations */
Mem **apArg; /* Arguments to currently executing user function */
Mem *aColName; /* Column names to return */
Mem *pResultSet; /* Pointer to an array of results */
int nMem; /* Number of memory locations currently allocated */
int nOp; /* Number of instructions in the program */
VdbeCursor **apCsr; /* One element of this array for each open cursor */