Skip to content

Instantly share code, notes, and snippets.

View mushfiq's full-sized avatar

Mushfiq mushfiq

View GitHub Profile
@mushfiq
mushfiq / squid.conf
Created November 16, 2011 10:08
Squid minimum configuration
# ----------------------------------------------------------------------
# WARNING - do not edit this template unless you know what you are doing
# ----------------------------------------------------------------------
# the parent cache
# disk and memory cache settings
cache_dir ufs /usr/local/squid/var/cache 500 16 256 #set your cache path with size
@mushfiq
mushfiq / README.md
Last active October 28, 2020 14:48

Backend web push service

To run the API, following settings need to be exported as env variables

  • VAPID email
  • VAPID private key path
  • VAPID public key path

Running the API

node_modules/*
*.data
@mushfiq
mushfiq / client.py
Created January 31, 2019 21:23 — forked from yoavram/client.py
Example of uploading binary files programmatically in python, including both client and server code. Client implemented with the requests library and the server is implemented with the flask library.
import requests
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
url = "http://localhost:5000/"
fin = open('simple_table.pdf', 'rb')
files = {'file': fin}
try:
r = requests.post(url, files=files)
print r.text
@mushfiq
mushfiq / http_streaming.md
Created August 19, 2018 00:04 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@mushfiq
mushfiq / binary_search.go
Created December 30, 2016 00:13
Binary search implementation using golang.
package main
import "fmt"
func elementExists(input_array []int, max_index int, min_index int, element int) bool {
middle_index := (min_index + max_index) / 2
found := false
if min_index > max_index {
return false
import os
import sys
from getpass import getpass
import gdata.docs.service
import gdata.spreadsheet.service
'''
get user information from the command line argument and
@mushfiq
mushfiq / loop_files_folders_recursively.go
Created May 6, 2016 13:48 — forked from francoishill/loop_files_folders_recursively.go
Loop through files and folders recursively in golang
package main
import (
"fmt"
"os"
"path/filepath"
)
func main() ([]string, error) {
searchDir := "c:/path/to/dir"
@mushfiq
mushfiq / Dockerfile
Created March 6, 2016 18:52
Docker file for running DRF based µ-service.
FROM python:2.7
MAINTAINER Mushfiq
ENV PYTHONUNBUFFERED 1
RUN git clone https://github.com/mushfiq/djmsc.git djmsc
WORKDIR djmsc