Skip to content

Instantly share code, notes, and snippets.

Avatar

Arul arulrajnet

View GitHub Profile
@arulrajnet
arulrajnet / namespace-hirearchy.js
Last active August 23, 2022 01:44
Build a tree based on namespace
View namespace-hirearchy.js
let listOfCategories = [
{
"id": 4,
"name": "JavaScript",
"namespace": "/1/2"
},
{
"id": 1,
"name": "Development",
"namespace": "/"
@arulrajnet
arulrajnet / http10server.py
Last active September 1, 2022 00:44
HTTP 1.0 upstream device for nginx proxy testing.
View http10server.py
#!/usr/bin/env python3
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from functools import partial
from http.server import HTTPServer, SimpleHTTPRequestHandler
import os
import sys
def log(*value, sep=' ', end='\n', file=sys.stdout, flush=False):
print(*value, sep=sep, end=end, file=file, flush=flush)
@arulrajnet
arulrajnet / TamilStopWords.txt
Created December 20, 2021 15:03
Tamil language stop words
View TamilStopWords.txt
அங்கு
அங்கே
அடுத்த
அதற்கு
அதனால்
அதன்
அதிக
அதில்
அது
அதே
@arulrajnet
arulrajnet / flask_tracing_request_id.py
Created September 10, 2021 15:05
Handling "X-Request-ID" tracing in flask with logger
View flask_tracing_request_id.py
#! /usr/bin/env python3
from flask import Flask, request
# Need python 3.7+
from contextvars import ContextVar
import logging
request_id_context = ContextVar("request_id")
# Flask app
app = Flask(__name__)
@arulrajnet
arulrajnet / README.md
Last active May 12, 2021 22:32
Script for point all youtube hostnames to single IP to minimize the youtube ads. Works with pihole
View README.md
@arulrajnet
arulrajnet / README.md
Created June 22, 2020 07:52
Script for point all youtube hostnames to single IP to minimize the youtube ads.
View README.md
@arulrajnet
arulrajnet / .env
Created February 20, 2019 09:15
httpbin using docker-compose with requestlog
View .env
GUNICORN_CMD_ARGS=--capture-output --error-logfile - --access-logfile - --access-logformat '%(h)s %(t)s %(r)s %(s)s Host: %({Host}i)s}'
@arulrajnet
arulrajnet / SimpleHTTPServerWithUpload.py
Last active August 2, 2019 05:27 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
View SimpleHTTPServerWithUpload.py
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@arulrajnet
arulrajnet / Dockerfile
Created March 30, 2016 04:27
Docker container for lighttpd on port 8080.
View Dockerfile
FROM alpine:3.3
# referred from https://hub.docker.com/r/sebp/lighttpd/
MAINTAINER Arul <me@arulraj.net>
RUN apk add --update lighttpd \
&& rm -rf /var/cache/apk/* \
&& sed -i.bak "s/server.document-root/#server.document-root/g" /etc/lighttpd/lighttpd.conf \
&& echo server.document-root = var.basedir >> /etc/lighttpd/lighttpd.conf \
&& echo server.port = 8080 >> /etc/lighttpd/lighttpd.conf \
@arulrajnet
arulrajnet / GetStockInfo.py
Created August 20, 2015 14:59
Python script to get the stock current and history information from command line. Google Finance Data used. It will accept stock code and interval range as list.
View GetStockInfo.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import namedtuple
from datetime import timedelta
import json
import datetime
import re
import sys
import getopt