Skip to content

Instantly share code, notes, and snippets.

Avatar

Suyash Garg ferbncode

View GitHub Profile
View init.vim
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'
View postgres_queries_and_commands.sql
-- 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 Jan 9, 2020
Exception for zalando/nakadi bug
View exception
[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
View 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.
View checkstyle > 6.19
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)
View 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
View onevsall.m
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];
View pylint error
************* 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 Aug 3, 2017
Cache needs to be initialized.
View 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:
View rg.sql
-- Automatically generated, do not edit.
-- release_group 8ef859e3-feb2-4dd1-93da-22b91280d768
SET client_min_messages TO 'warning';
-- Temporarily drop triggers.
DROP TRIGGER deny_deprecated ON link;
ALTER TABLE medium DISABLE TRIGGER ALL;INSERT INTO area (begin_date_day, begin_date_month, begin_date_year, comment, edits_pending, end_date_day, end_date_month, end_date_year, ended, gid, id, last_updated, name, type) VALUES
(NULL, NULL, NULL, '', 0, NULL, NULL, NULL, '0', '489ce91b-6658-3307-9877-795b68554c98', 222, '2013-06-15 18:06:39.59323+00', 'United States', 1),