Skip to content

Instantly share code, notes, and snippets.

View karthicraghupathi's full-sized avatar

Karthic Raghupathi karthicraghupathi

View GitHub Profile
@karthicraghupathi
karthicraghupathi / Outbound setup for freeswitch.md
Created April 3, 2024 18:52 — forked from govind0229/Outbound setup for freeswitch.md
Free-switch outbound calling through Asterisk setup

Freeswitch outbound calling through Asterisk

[cloud]
type=peer
host=X.X.X.X
port=5080
allow=all
;allow=ulaw
;allow=alaw
trustrpid=yes

Setup nut and netdata on Ubuntu

In this document, I will explain how to setup nut (Network UPS Tools) on Ubuntu 18.04 and 20.04.

It is basically the next chapter of my previous gist, Upgrade nut on Ubuntu 18.04.

I'll only document USB connected UPS and not the other supported connection modes.

Install required dependencies

@karthicraghupathi
karthicraghupathi / gunicorn.md
Created February 28, 2024 22:16 — forked from zpoint/gunicorn.md
difference bwtween gunicorn workers(sync/eventlet/gevent/thread/tornado)

gunicorn workersimage title

We've learned SyncWorker for gunicorn in part1, now let's see how other workers work

workers

contents

@karthicraghupathi
karthicraghupathi / github_bitbucket_multiple_ssh_keys.md
Created February 21, 2024 17:24 — forked from yinzara/github_bitbucket_multiple_ssh_keys.md
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@karthicraghupathi
karthicraghupathi / advanced_requests.py
Last active February 7, 2023 07:18
Advanced usage of python requests - timeouts, retries, hooks
import requests
from requests.adapters import HTTPAdapter, Retry
DEFAULT_TIMEOUT = 5
class TimeoutHTTPAdapter(HTTPAdapter):
"""Set a default timeout for all HTTP calls."""

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@karthicraghupathi
karthicraghupathi / mail.py
Last active August 16, 2022 17:59
Send email in Python 3
import smtplib
import traceback
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.utils import COMMASPACE, formataddr, formatdate, parseaddr
from pathlib import Path
from typing import List
@karthicraghupathi
karthicraghupathi / alignment.patch
Created August 14, 2022 17:57
Installing Python 3.6.15 on PopOS / Ubuntu 22.04 via pyenv - Segmentation fault (core dumped) make: *** [Makefile:1102: install] Error 139
--- Include/objimpl.h
+++ Include/objimpl.h
@@ -250,7 +250,7 @@
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
- double dummy; /* force worst-case alignment */
+ long double dummy; /* force worst-case alignment */
} PyGC_Head;
@karthicraghupathi
karthicraghupathi / admin.py
Last active August 5, 2022 21:59
A Django Admin Paginator For MariaDB With Many Many Rows
from django.contrib import admin
from django.core.paginator import Paginator
from django.db import connection, transaction, OperationalError
from django.utils.functional import cached_property
class MariaDbInnoDbPaginator(Paginator):
"""
Paginator that enforces a 2 second timeout on the count operation.
If the operations times out, an approximate value is returned.
@karthicraghupathi
karthicraghupathi / time_limited_paginator.py
Created August 4, 2022 15:40 — forked from hakib/time_limited_paginator.py
CountTimeoutLimitPaginator - Paginator that enforced a timeout on the count operation.
class TimeLimitedPaginator(Paginator):
"""
Paginator that enforced a timeout on the count operation.
When the timeout is reached a "fake" large value is returned instead,
Why does this hack exist? On every admin list view, Django issues a
COUNT on the full queryset. There is no simple workaround. On big tables,
this COUNT is extremely slow and makes things unbearable. This solution
is what we came up with.
"""