Skip to content

Instantly share code, notes, and snippets.

View ferbncode's full-sized avatar
👋

Suyash Garg ferbncode

👋
View GitHub Profile
@ferbncode
ferbncode / sol.py
Created October 26, 2022 10:34
Compare dfs
import pandas as pd
PM = {'SKU': ['Jai', 'Princi', 'Gaurav', 'Anuj', 'Jai'], 'SALE': [27, 24, 22, 32, 89], 'STORE': ['Delhi', 'Kanpur', 'Allahbad', 'Kanauj', 'Delhi']}
CM = {'SKU': ['Jai', 'Princi', 'Gaurav', 'Anuj', 'Dinesh'], 'SALE': [45, 24, 29, 15, 40], 'STORE': ['Delhi', 'Kanpur', 'Allahbad', 'Kanauj', 'Delhi']}
PY = {'SKU': ['Jai', 'Princi', 'Gaurav', 'Anuj', 'Dinesh'], 'SALE': [38, 10, 56, 15, 40], 'STORE': ['Delhi', 'Kanpur', 'Allahbad', 'Kanauj', 'Delhi']}
prevMonth = pd.DataFrame(PM)
currentMonth = pd.DataFrame(CM)
previousYear = pd.DataFrame(PY)
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
"
" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align'
Plug 'scrooloose/nerdcommenter'
"
" " Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git'
@ferbncode
ferbncode / postgres_queries_and_commands.sql
Created October 24, 2020 22:51 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ferbncode
ferbncode / exception
Last active January 9, 2020 09:40
Exception for zalando/nakadi bug
[ERROR] [13eb51db-20ff-4521-b9af-3b58b2c4f337] [MvcAsync59522] [s.42daf9d5-ac25-5a07-a37b-a3a77b3c5f54.f1a757d0-32be-42b6-9e99-8e8798a79045.zk] --- Failed to release lock
java.io.IOException: org.apache.zookeeper.KeeperException$SessionExpiredException: KeeperErrorCode = Session expired for /nakadi/locks/subscription_42daf9d5-ac25-5a07-a37b-a3a77b3c5f54/leases/_c_8f3f7ac9-9565-483e-b024-00095aabbf27-lease-0097814999
#011at org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2$3.close(InterProcessSemaphoreV2.java:465)
#011at org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex.release(InterProcessSemaphoreMutex.java:71)
#011at org.zalando.nakadi.service.subscription.zk.AbstractZkSubscriptionClient.runLocked(AbstractZkSubscriptionClient.java:117)
#011at org.zalando.nakadi.service.subscription.zk.ZkSubscriptionClient.runLocked(ZkSubscriptionClient.java:40)
#011at org.zalando.nakadi.service.subscription.state.StartingState.onEnter(StartingState.java:43)
#011at org.zalando.nakadi.ser
@ferbncode
ferbncode / musicbrainz_test_database
Created July 1, 2019 14:43
musicbrainz_test_database
➜ ~ docker run --expose 5432 -p 5432:5432 metabrainz/musicbrainz-test-database:production
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
Downloaded: https://repo.maven.apache.org/maven2/net/sf/saxon/Saxon-HE/9.9.1-1/Saxon-HE-9.9.1-1.jar (5350 KB at 19242.8 KB/sec)
Jun 19, 2019 7:34:51 AM org.sonatype.guice.bean.reflect.Logs$JULSink warn
WARNING: Error injecting: org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo
java.lang.UnsupportedClassVersionError: com/puppycrawl/tools/checkstyle/api/AuditListener : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:808)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:443)
at java.net.URLClassLoader.access$100(URLClassLoader.java:65)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
@ferbncode
ferbncode / build
Created December 11, 2017 05:46
build
Building db
Step 1/2 : FROM postgres:9.5.4
---> 2417ea518abc
Step 2/2 : ADD create_extensions.sql /docker-entrypoint-initdb.d/
---> Using cache
---> 8d41a43b5b71
Successfully built 8d41a43b5b71
Successfully tagged docker_db:latest
Building db_test
Step 1/2 : FROM postgres:9.5.4
function [all_theta] = oneVsAll(X, y, k, lambda)
m = size(X, 1);
n = size(X, 2);
alpha = 0.01;
% this is storing all the theta for all the individual problems
all_theta = zeros(k, n + 1); % 6 x (n+1)
X = [ones(m, 1) X];
************* Module critiquebrainz.frontend.views.mapping
mapping.py:145: [R1705(no-else-return), spotify_report] Unnecessary "else" after "return"
-----------------------------------
Your code has been rated at 9.91/10
@ferbncode
ferbncode / Cache needs to be initialized
Created August 3, 2017 10:04
Cache needs to be initialized.
================================================================================= FAILURES ==================================================================================
_______________________________________________________________________ PlaceTestCase.test_get_by_id ________________________________________________________________________
self = <critiquebrainz.frontend.external.musicbrainz_db.tests.place_test.PlaceTestCase testMethod=test_get_by_id>
def test_get_by_id(self):
self.place_query.return_value = [place_suisto]
> place = mb_place.get_place_by_id('d71ffe38-5eaf-426b-9a2e-e1f21bc84609')
place_test.py:15: