Skip to content

Instantly share code, notes, and snippets.

A different error message! Finally some progress!

Pradip Caulagi caulagi

A different error message! Finally some progress!
View GitHub Profile
caulagi / findUser.js
Created Feb 28, 2021
Find a user asynchronously from the database. If that succeeds, return the user. Else return the error
View findUser.js
User.findOne({ email: email }, function (err, user) {
if (err) { return done(err) }
if (!user) {
return done(null, false, { message: ‘Unknown user’ })
if (!user.authenticate(password)) {
return done(null, false, { message: ‘Invalid password’ })
return done(null, user)
caulagi / tonic-trace.txt
Created Dec 23, 2020
there is no reactor running
View tonic-trace.txt
thread 'main' panicked at 'there is no reactor running, must be called from the context of Tokio runtime', /Users/pradip.caulagi/.cargo/registry/src/
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/
1: core::panicking::panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/
2: core::option::expect_failed
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/
3: core::option::Option<T>::expect
at /Users/pradip.caulagi/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/
View gist:94d082100c307e1b39128ca82ac43a17
$ kubectl -n capg-system get pod capg-controller-manager-68869d55b7-nkhjm -o yaml
apiVersion: v1
kind: Pod
creationTimestamp: "2020-11-11T19:41:14Z"
generateName: capg-controller-manager-68869d55b7-
labels: infrastructure-gcp
control-plane: capg-controller-manager
pod-template-hash: 68869d55b7
caulagi / readme-gen.html
Created Feb 29, 2020
Create images for README's
View readme-gen.html
<!DOCTYPE html>
div {
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
font-size: 22px;
line-height: 1;
opacity: 0.70;
View gist:81fcac40fc79063f14455dcb096d64e4
Finished dev [unoptimized + debuginfo] target(s) in 1.56s
Running `target/debug/frontend-server`
thread 'main' panicked at 'no current reactor', /Users/pradip.caulagi/.cargo/registry/src/
stack backtrace:
0: 0x106200065 - std::sys_common::at_exit_imp::push::h0636e6b5f7616352
1: 0x10621ae90 - core::fmt::ArgumentV1::show_usize::hca33af0aed7db5c5
2: 0x1061fba5b - std::io::Write::write_fmt::he6837371b9a45188
3: 0x106201da3 - std::panicking::default_hook::{{closure}}::h708e66cfeb0483ba
4: 0x106201aaa - std::panicking::default_hook::h39ea8ddf674c04ec
5: 0x10620246b - <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get::hf147e9d6b92d24d8
View no-current-reactor
Finished dev [unoptimized + debuginfo] target(s) in 0.18s
Running `target/debug/frontend-server`
thread 'main' panicked at 'no current reactor', /Users/pradip.caulagi/.cargo/registry/src/
stack backtrace:
0: std::sys_common::at_exit_imp::push
1: core::fmt::ArgumentV1::show_usize
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
import asyncio
async def fibonacci(n, marker):
print(f'Marker: {marker}')
if n < 2:
return 1
return await fibonacci(n-1, marker) + await fibonacci(n-2, marker)
View fluent-bit.conf
Flush 1
Daemon Off
Log_Level debug
Parsers_File parsers.conf
Name tail
Path /var/log/containers/*.log
Parser docker
caulagi /
Created Mar 12, 2018
Example cherrypy sentry integration
def register_sentry(): = cherrypy.Tool('before_error_response', report_to_sentry)
'tools.report_to_sentry.on': True
def report_to_sentry():
sentry_dsn = settings.sentry_dsn
if not sentry_dsn:
caulagi /
Last active Feb 6, 2018
Illustrative python snippets

A list of python snippets I find interesting

  • The Python standard library has an implementation of Counter that is typically used to find the most common items in a a collection, with their count. I find the implement of collections.Counter instructive in general. I especially like the implementation of most_commonlink. I find it interesting how most_common determines which method to use for efficiency reasons (based on n).

  • In heapq module (standard library), implemention of nsmallestlink. In general, the heapq module has awesome comments. This is true for nsmallest method also. Also, I like how this method is lazy (stores only k items irrespective of input) and generic (the optional key).