Skip to content

Instantly share code, notes, and snippets.

View caulagi's full-sized avatar
🎧
A different error message! Finally some progress!

Pradip Caulagi caulagi

🎧
A different error message! Finally some progress!
View GitHub Profile
@caulagi
caulagi / ubuntu-dev-setup.md
Last active February 4, 2024 18:02
Install necessary packages on a fresh Ubuntu box

Base steps

# Enable multiverse repository
sudo sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list

sudo apt-get update
sudo apt-get upgrade -y

export LANGUAGE=en\_US.UTF-8
@caulagi
caulagi / findUser.js
Created February 28, 2021 16:50
Find a user asynchronously from the database. If that succeeds, return the user. Else return the error
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
caulagi / tonic-trace.txt
Created December 23, 2020 23:15
there is no reactor running
thread 'main' panicked at 'there is no reactor running, must be called from the context of Tokio runtime', /Users/pradip.caulagi/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.24/src/io/driver/mod.rs:204:14
stack backtrace:
0: rust_begin_unwind
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:483
1: core::panicking::panic_fmt
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/panicking.rs:85
2: core::option::expect_failed
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/option.rs:1226
3: core::option::Option<T>::expect
at /Users/pradip.caulagi/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/option.rs:346
@caulagi
caulagi / gist:94d082100c307e1b39128ca82ac43a17
Last active November 11, 2020 20:17
Capg imagepullpolicy
$ kubectl -n capg-system get pod capg-controller-manager-68869d55b7-nkhjm -o yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2020-11-11T19:41:14Z"
generateName: capg-controller-manager-68869d55b7-
labels:
cluster.x-k8s.io/provider: infrastructure-gcp
control-plane: capg-controller-manager
pod-template-hash: 68869d55b7
@caulagi
caulagi / readme-gen.html
Created February 29, 2020 11:06
Create images for README's
<!DOCTYPE html>
<html>
<head>
<title>Mermite</title>
<style>
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;
@caulagi
caulagi / gist:81fcac40fc79063f14455dcb096d64e4
Created January 3, 2020 19:01
No current reactor full
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/github.com-1ecc6299db9ec823/tokio-0.2.6/src/io/driver/mod.rs:243:21
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
@caulagi
caulagi / no-current-reactor
Created January 3, 2020 18:46
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/github.com-1ecc6299db9ec823/tokio-0.2.6/src/io/driver/mod.rs:243:21
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
@caulagi
caulagi / fibonacci_await.py
Created December 10, 2018 12:23
Fibonacci Await
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)
[SERVICE]
Flush 1
Daemon Off
Log_Level debug
Parsers_File parsers.conf
[INPUT]
Name tail
Path /var/log/containers/*.log
Parser docker
@caulagi
caulagi / cherry-sentry-integration.py
Created March 12, 2018 18:58
Example cherrypy sentry integration
def register_sentry():
cherrypy.tools.report_to_sentry = cherrypy.Tool('before_error_response', report_to_sentry)
cherrypy.config.update({
'tools.report_to_sentry.on': True
})
def report_to_sentry():
sentry_dsn = settings.sentry_dsn
if not sentry_dsn: