Skip to content

Instantly share code, notes, and snippets.

View Innarticles's full-sized avatar
😇
I'm Innocent

Innocent Udeogu Innarticles

😇
I'm Innocent
View GitHub Profile
@Innarticles
Innarticles / combine_csvs.py
Created August 25, 2018 16:02
Combine data from several csv files
import glob
import pandas as pd
path ='/' # use your path
allFiles = glob.glob("*.csv")
frame = pd.DataFrame()
list_ = []
for file_ in allFiles:
df = pd.read_csv(file_,index_col=None, header=None)
list_.append(df)
max = 0.0
if !QaCorp.where("question like ?", "%#{self.text}%").empty?
# Exact question exist in the database.
answer = QaCorp.where("question like ?", "%#{self.text}%").first.answer
max = 1.0
else
corpus = QaCorp.all.map {|qa| TfIdfSimilarity::Document.new(qa.question)}
d_question = TfIdfSimilarity::Document.new(self.text)
corpus << d_question
model = TfIdfSimilarity::TfIdfModel.new(corpus, :library => :nmatrix)
h moves the cursor one character to the left.
j moves the cursor down one line.
k moves the cursor up one line.
l moves the cursor one character to the right.
0 moves the cursor to the beginning of the line.
$ moves the cursor to the end of the line.
w move forward one word.
b move backwards one word.
G move to the end of the file.
gg move to the beginning of the file.

Challenge Specs:

Using Ruby on Rails we would like you to create a simple blog api-only application. The application should fulfill the requirements below. Any one can create a blog with or without a loggedin account.

  • You can only comment as a authenticated user (logged in).
  • You can not commment on more than 2 blogs in a given day 24 hours period.
  • Your api must be in line with JsonAPI standards.
  • The source code must be placed in a public repo on GitHub.
  • The application should be deployable on Heroku.
@Innarticles
Innarticles / bucket_sync_service.rb
Created March 17, 2020 06:25 — forked from edwardsharp/bucket_sync_service.rb
ruby class to copy from one aws s3 bucket to another based on bantic/bucket_sync_service.rb
require 'aws-sdk'
class BucketSyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
DEFAULT_ACL = "public-read"
def initialize(from_bucket, to_bucket)
@Innarticles
Innarticles / PG::ConnectionBad - could not connect to server: Connection refused
Created May 19, 2020 09:20
To fix it remove/rename the PID file. Find the postgres data directory. On macOS using homebrew it is in /usr/local/var/postgres/, or /usr/local/var/log/ other systems it might be /usr/var/postgres/. To make sure this is the problem, look at the log file (server.log).
To fix it remove/rename the PID file. Find the postgres data directory. On macOS using homebrew it is in /usr/local/var/postgres/, or /usr/local/var/log/ other systems it might be /usr/var/postgres/.
To make sure this is the problem, look at the log file (server.log). On the last lines you will see:
```
FATAL: lock file "postmaster.pid" already exists
HINT: Is another postmaster (PID 347) running in data directory "/usr/local/var/postgres"?
```
If so, `rm postmaster.pid`
Restart your server. On a mac using launchctl (with homebrew) the following commands will restart the server.