Skip to content

Instantly share code, notes, and snippets.

View aryan1107's full-sized avatar
🏂

Aryan Chaurasia aryan1107

🏂
View GitHub Profile
Setting up HTTPS for self-hosted Sentry
Sentry, a very powerful error-tracking tool, can easily be self-hosted. Their self-hosted Github repo and documentation explain this very well.
To add HTTPS support to the instance isn’t explained in detail though. In this post I give a brief description of how HTTPS using Traefik and Let’s Encrypt can be added quite easily.
Traefik
Traefik is a reverse-proxy, meaning it is the door to your application, Sentry in our case. Traefik routes incoming requests to specific applications based on routing rules. As Sentry comes with Nginx, and Nginx is also a reverse-proxy, we are going to disable Nginx.
Enabling HTTPS
@aryan1107
aryan1107 / test.js
Last active June 5, 2023 05:05
test
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({
@aryan1107
aryan1107 / uniquewordss.md
Created February 20, 2023 20:05
Calculate unique words in entire pandas column

To calculate the number of unique words in a Pandas column, you can use the following code:

import pandas as pd

# Load data into a DataFrame
df = pd.read_csv('data.csv')

# Split the column by space and count unique words
unique_words = set()
https://cut-hardhat-23a.notion.site/code-for-webGPT-44485e5c97bd403ba4e1c2d5197af71d
from serpapi import GoogleSearch
import requests
import openai
import logging
import sys, os
@aryan1107
aryan1107 / grokking_to_leetcode.md
Created August 7, 2022 01:56 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@aryan1107
aryan1107 / images.txt
Last active June 29, 2022 18:13
dalle mini image
[{'image': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nFz9WbOkWZYdhq219/nc/bpfv/MUc2REjpWZVdU1dHc10AO6G2gAJChAAmGUaBLJJ9FML/oVetCbzGQmM4pGPVAmCSY9UE2MBImhgO6uriGzsnKOjHm88+zj95299bDPFwVTt5V1ddwIv+6fn3P22mutvQ7/F/9XXG7ApnBABPUcVQcONI6U0BjoSAkGNBlaoUqwBiAIkHBAFEJQ4A2SwoC6QSehk+AGCJAhIqRZA0dKCZCGLqrJsggqgi5uNqdI0iqbwTtCdcLdRESoTvfGVTtOq5smSbeb1B0OFScogLvBPSUFtBZPZIIpXUXU4WZZVJXMOdO7IhUAAEKhJ4owk6wgnnMWdCpV0OBJmdyVAAB3cc+aKBR3wCqh0ulwgqSIwMwJJcXclUISJiIqEJAON3NxVRHQ6UoKXeAgxEF3E2lf37X8F4AknCKEw52guLtQSMCFFDpBOgCHG1QUMEJIcY8f0AFzUxUCZgaIipoby3dAisBBYXZzAEYVAQ1OEXUHnQAcMMuqQtLc4CJCMwMgpDtFBO4UyZ7dHcYkApojPhphDhKgeSNCkmYZEKEYjHCBmAEiBOK3uAMOETrjF4k743sxh7uLQASNZQHB8j4F4qTD3c0oaCQlbZqGxs7CCv/a/xsE1NEIsoOAxLonnIBBBQAyAaKqkB0kxAFAX28ARyYEoKIxiKAncBeDC4QOoThg8JQ6bqAYXQClsxLN5hCY5aqjOQOQxMpdhMncRJTmJkZ3ptQYSelqgpXXh0FEHDD3qqosQ8TpGq+fmNzhoLtXqo0bnZV0zVWZYE4ReCxTV+1kB8COVOYCuLiQCqdScjZJaoakdAMo4qpMbgAIQCkGh3tKVTYKRZwOECIkzEU0uwOsNLnR4QISCoe4OAkQDlWaAaBA46cEHRTS4XCIqDmESm+3HggHSQfckUTNCR
@aryan1107
aryan1107 / debug.txt
Last active August 8, 2022 20:48
debugging
jax.tree_util.tree_multimap() is deprecated. Please use jax.tree_util.tree_map() instead as a drop-in replacement.
scatter inputs have incompatible types: cannot safely cast value from dtype=float16 to dtype=float32. In future JAX releases this will result in an error.
[{'images': ['data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAIAAADTED8xAAEAAElEQVR4nIz9aa9tW5Idho0Rc6619z7t7e/rMvNlw6yGVLFIFilYkChQEkhDbuAPhn+Uf4E/GTAg+IsNG7JlyAYsgJRlCi7SZFWxWGRVZf/6d5tz7ml2s9aMGP4Qc+1zk2YVdTLfve/du8/Ze805I2LEiBEx+Ud/vNk/2tkEEhDUUApk8AABAWYwos2wAhsAQQ4IxQAgBCMo0GCAVUwHSKgFlXABMKKUQqCFoGZA2AATJSPXECNmmAodUDEgNNShafbZi5VKV0CBuhqB8XCwMj7f6vzb7fC/+9//k//t/xH4M2ACBgCAAwUYgQAugRH83dXL8fA/+Y/w8hzff4Tf/RsXp+O60Idx7fMkUGxyDyeioVRILWioxSzUJDeWUuW+h4qiFBrKJIeVogAEM7g3qZXBaO5thlZmNcIFGKuc4FzMWDUddhHjWFeFcjlgAI0AGo3uLrhVEIEAUM1qKCQjBIggbRCoiFAz1moBa6DroLFuwg6+99XqQpiIEjHO83iY126P/+SXb/+L/8Pn/+V/4bjHv/2rYPXX8L/5Xz/94Fn58NEjmwvr5DpYVGCSN4wKj3Az1mIl1Dy8sNAQmo0MF0EbZsEpigUioIAIAGYMGkB6O0ArYlVpUSYEwSrJQBpDLdBoABvYrNbw5k6zQoRCVoKQDWrTBB
@aryan1107
aryan1107 / lit_nlp.examples.tydi_demo.txt
Created June 14, 2022 13:28
lit_nlp.examples.tydi_demo Stack Trace
(lit-nlp) aryan@Aryans-MacBook-Pro lit % python -m lit_nlp.examples.tydi_demo \
--alsologtostderr --port=5432 --max_examples=10 \
--nouse_indexer
RuntimeError: module compiled against API version 0xf but this version of numpy is 0xd
INFO:absl:Unable to initialize backend 'tpu_driver': NOT_FOUND: Unable to find driver in registry given worker:
INFO:absl:Unable to initialize backend 'gpu': NOT_FOUND: Could not find registered platform with name: "cuda". Available platform names are: Host Interpreter
INFO:absl:Unable to initialize backend 'tpu': INVALID_ARGUMENT: TpuPlatform is not available.
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
Some weights of the model checkpoint at mrm8488/bert-multi-cased-finedtuned-xquad-tydiqa-goldp were not used when initializing FlaxBertModel: {('encoder', 'layer', '5', 'attention', 'output', 'LayerNorm', 'bias'), ('encoder', 'layer', '3', 'attention', 'output', 'LayerNorm', 'bias'), (
@aryan1107
aryan1107 / glue_demo.py
Last active March 27, 2022 04:09
Spam_Classifier Demo for 🔥LIT
# Lint as: python3
r"""Example demo loading a handful of GLUE models.
For a quick-start set of models, run:
python -m lit_nlp.examples.glue_demo \
--quickstart --port=5432
To run with the 'normal' defaults, including full-size BERT models:
python -m lit_nlp.examples.glue_demo --port=5432
@aryan1107
aryan1107 / glue_demo.py
Last active March 19, 2022 23:41
Just added another model in existing GLUE demo
# Lint as: python3
r"""Example demo loading a handful of GLUE models.
For a quick-start set of models, run:
python -m lit_nlp.examples.glue_demo \
--quickstart --port=5432
To run with the 'normal' defaults, including full-size BERT models:
python -m lit_nlp.examples.glue_demo --port=5432