Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Abhinav Mishra abhinavmsra

🎯
Focusing
View GitHub Profile
@abhinavmsra
abhinavmsra / cff.sol
Created May 26, 2019
CFF 4 UNICEF - SURGE BANGKOK
View cff.sol
pragma solidity >=0.4.22 <0.7.0;
contract CFF {
struct CFFChild {
string name;
string homeAddress;
uint dob; // timestamp of birth of a child,
uint withdrawalBalance;
uint lockedBalance;
@abhinavmsra
abhinavmsra / ballot_test.sol
Created May 24, 2019
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.8+commit.23d335f2.js&optimize=true&gist=
View ballot_test.sol
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "./ballot.sol";
contract test3 {
Ballot ballotToTest;
function beforeAll () public {
ballotToTest = new Ballot(2);
}
@abhinavmsra
abhinavmsra / pg_locks.md
Created Mar 21, 2019
How to list postgres locks & release them
View pg_locks.md

List all active locks

SELECT 
  DISTINCT age(now(), query_start) AS age, 
  pg_stat_activity.pid,
  pg_locks.granted,
  pg_stat_activity.application_name,
  pg_stat_activity.backend_start, 
 pg_stat_activity.xact_start, 
View pronto.md
  1. Add pronto and other pronto runners under test group in Gemfile
  group :test do
    gem 'pronto'
    gem 'pronto-rubocop', require: false # analyzes ruby code 
    gem 'pronto-flay', require: false # analyzes code for structural similarities
    gem 'pronto-brakeman', require: false # analyzes code for security vulnerabilities
    gem 'pronto-dirty_words', require: false # analyzes code for  Seven Dirty Words
 gem 'pronto-rails_best_practices', require: false # code metric tool for Rails projects 
View react-project-guidelines.md

Project boilerplate

While React itself doesn't enforce any specific project strucutre or setup for that matter, it's always better to have a boilerplate at disposal to kickstart a React project.

After studying some of the available boilerplates, we found react-slingshot from a Pluralsight Author coryhouse quite handy. However it is to be noted that it's just a recommendation and subject to personal preference and at some times project requirements.

Project Strucutre

@abhinavmsra
abhinavmsra / flatten_array.rb
Created Jul 16, 2016
Flattens an array of arbitrarily nested arrays of integers into a flat array of integers
View flatten_array.rb
# Flattens an array of arbitrarily nested arrays of integers into a flat array of integers
#
# Algorithm:
# 1. Iterate over each element in the array.
# 2. If the element contains nested array elements, apply the same function recursively to each elements.
# 3. For integer values, push them into a flat array
#
# @param array[Array], nested array to be flattened
# @return [Array], flattened array
def flatten(array)
@abhinavmsra
abhinavmsra / rspec_json_helper.md
Created Jul 11, 2016
DRY JSON Parsing in Rspec Tests
View rspec_json_helper.md
# spec/support/request_helpers.rb
module Requests
  module JsonHelpers
    def json
      JSON.parse(response.body)
    end
  end
end
View resume.md

Personal Info:

Fullname: Abhinav Mishra
Education: Bachelor's Degree in Electronics & Communication Engineering at Pulchowk Campus, 
            Tribhuvan University from 2010 - 2014
Address: Kathmandu, Nepal
TEL: +977-9842529593
Email: msraabhinav@gmail.com
Twitter: @abhinavmsra

Skype: abhinavmsra

@abhinavmsra
abhinavmsra / rotate.md
Last active Aug 16, 2018
Rotating Server Logs
View rotate.md

#Rotating Server Logs with LogRotate

Logrotate is a UNIX utility that does following operations:

  1. Rotates the log file when file size reaches a specific size or after a specified duration
  2. Continues to write the log information to the newly created file after rotating the old log file
  3. Compresses the rotated log files
  4. Specifies compression option for the rotated log files
@abhinavmsra
abhinavmsra / s3cmd.md
Last active Jun 6, 2020
Install s3cmd on CentOs
View s3cmd.md

Installing s3cmd on CentOs

  1. As a superuser, go to /etc/yum.repos.d

    cd /etc/yum.repos.d

  2. Download the repo file

    wget http://s3tools.org/repo/RHEL_6/s3tools.repo