Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Hitesh Joshi hiteshjoshi

🎯
Focusing
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am hiteshjoshi on github.
  • I am hiteshj (https://keybase.io/hiteshj) on keybase.
  • I have a public key ASAExxh2N001dm4F6Dx9YviDSxhQRytF-AQPejWw14Q4Wgo

To claim this, I am signing this object:

@hiteshjoshi
hiteshjoshi / httputils.py
Created May 7, 2019 — forked from rizkyabdilah/httputils.py
simple wrapper for httplib, provide simple High Level API trough python httplib
View httputils.py
import re
import urllib
import httplib
import mimetypes
import os
regex_url = re.compile("^(?:(?P<scheme>http|ftps?):\/\/)?(?:(?:(?P<username>[\w\.\-\+%!$&'\(\)*\+,;=]+):*(?P<password>[\w\.\-\+%!$&'\(\)*\+,;=]+))@)?(?P<host>[a-z0-9-]+(?:\.[a-z0-9-]+)*(?:\.[a-z\.]{2,6})+)(?:\:(?P<port>[0-9]+))?(?P<path>\/(?:[\w_ \/\-\.~%!\$&\'\(\)\*\+,;=:@]+)?)?(?:\?(?P<query>[\w_ \-\.~%!\$&\'\(\)\*\+,;=:@\/]*))?(?:(?P<fragment>#[\w_ \-\.~%!\$&\'\(\)\*\+,;=:@\/]*))?$")
def parse_url(url):
match = re.match(regex_url, url, re.IGNORECASE)
View redis-haproxy.cfg
defaults
mode tcp
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http
bind :8080
@hiteshjoshi
hiteshjoshi / iframe.js
Created Feb 4, 2017
mithriljs iframe on the fly
View iframe.js
const proxy = function(vnode){
var doc = vnode.dom.contentDocument || vnode.dom.contentWindow.document;
if (doc.readyState === "complete") {
m.render( vnode.dom.contentDocument.documentElement, vnode.children )
} else{
setTimeout(function(){proxy(vnode);},0);
}
}
View h2o configuration
user: www-data
hosts:
"localhost:443":
listen:
port: 443
ssl:
certificate-file: "/etc/nginx/ssl/haip.me.cert"
key-file: "/etc/nginx/ssl/haip.me.key"
cipher-suite: "HIGH:!aNULL:!MD5"
dh-file: "/etc/nginx/ssl/dhparam.pem"
View golang-twilio-voice.go
package main
import (
"encoding/xml"
"net/http"
"net/url"
"fmt"
"strings"
"io/ioutil"
"encoding/json"
@hiteshjoshi
hiteshjoshi / nginx.conf
Last active Nov 2, 2016
nginx configuration
View nginx.conf
server {
#server_name _;
listen 80 default_server; # ipv4
proxy_read_timeout 3600;
root /usr/html; #SERVER PATH HERE
index index.html index.htm;
charset utf-8;
@hiteshjoshi
hiteshjoshi / uiappearance-selector.md
Created Jul 13, 2016 — forked from mattt/uiappearance-selector.md
A list of methods and properties conforming to `UIAppearance` as of iOS 8.0
View uiappearance-selector.md

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

@hiteshjoshi
hiteshjoshi / nodejs-app.conf
Last active Sep 8, 2015 — forked from louischatriot/nodejs-app.conf
Upstart script to launch a nodejs application as a service
View nodejs-app.conf
description "Upstart script to run a nodejs app as a service"
author "Louis Chatriot"
env NODE_BIN=/usr/local/bin/node
env APP_DIR=/path/to/app/dir
env SCRIPT_FILE="scriptfile.js" # Entry point for the nodejs app
env LOG_FILE=/path/to/logfile.log
env RUN_AS="anyuser" # Upstart can only be run nicely as root, need to drop privileges
env SERVER_ENV="anything" # Usual apps can be run in different environments (development, test, production ...)
# I typically use the environment variable NODE_ENV (see below)
View zsh.md

Prereq:

apt-get install zsh
apt-get install git-core

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
You can’t perform that action at this time.