Skip to content

Instantly share code, notes, and snippets.

View HorizonXP's full-sized avatar

Xitij Ritesh Patel HorizonXP

View GitHub Profile
@HorizonXP
HorizonXP / server.py
Last active April 19, 2020 00:02 — forked from apackeer/server.py
SimpleHTTPServer with history API fallback
#!/usr/bin/env python
"""
Modification of `python -m http.server` with a fallback to /index.html
on requests for non-existing files.
This is useful when serving a static single page application using the HTML5
history API.
"""
@HorizonXP
HorizonXP / keybase.md
Created July 18, 2019 14:46
Keybase proof

Keybase proof

I hereby claim:

  • I am horizonxp on github.
  • I am xpatel (https://keybase.io/xpatel) on keybase.
  • I have a public key ASAY74FV4pyLgqo3-cc9jvErX_8jyJsjQa-ve0yCldoyRwo

To claim this, I am signing this object:

@HorizonXP
HorizonXP / index.html
Last active May 10, 2017 22:37 — forked from TheMcMurder/index.html
Convert SVG file from absolute to relative
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>
// @info
[root@kube-01-worker ~]# tcpdump -i docker0 -n host 10.2.20.3
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on docker0, link-type EN10MB (Ethernet), capture size 262144 bytes
01:27:00.855186 IP 10.2.20.3.56380 > 10.2.20.1.37510: UDP, length 40
01:27:05.860805 IP 10.2.20.3.58141 > 8.8.8.8.domain: 3+ PTR? 10.0.3.10.in-addr.arpa. (40)
01:27:05.863536 ARP, Request who-has 10.2.20.1 tell 10.2.20.3, length 28
01:27:05.863563 ARP, Reply 10.2.20.1 is-at 02:42:b7:fb:35:53, length 28
01:27:06.859177 IP 10.3.0.10.domain > 10.2.20.3.56380: 2 ServFail- 0/0/0 (40)
01:27:06.859228 IP 10.2.20.3 > 10.2.20.1: ICMP 10.2.20.3 udp port 56380 unreachable, length 76
01:27:06.947568 IP 10.20.0.27 > 10.2.20.3: ICMP host 8.8.8.8 unreachable, length 76
var result_count = 0;
var endpoint_source = this.props.endpointsSource;
// Get number of results
var page = 1;
var page_size = 10;
while (page != -1) {
$.get(
endpoint_source + "?page_size=" + page_size + "&page=" + page,
function(result) {
from django.conf.urls import patterns, include, url
from strata.forms import AuthenticationForm, PasswordResetForm, UserCreationForm
from strata.views import AccountRegistrationView
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'strata.views.home', name='home'),
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.contrib.admin.views.decorators import staff_member_required
from django.conf.urls import patterns, url
from django.http import HttpResponseRedirect
from kar.models import Post, Location, Event, PostAdmin, LocationAdmin, EventAdmin, GuestAdminInline, User
import warnings
from django.db import models
from django.contrib import admin
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser, PermissionsMixin
)
from django.utils import timezone
from django.utils.http import urlquote
from django.utils.translation import ugettext_lazy as _
def sendEmailViaInvoke(self, path = None):
import bb.invoke as ni
import ctypes as ct
invoke = self.invoke = ct.POINTER(ni.navigator_invoke_invocation_t)()
ni.navigator_invoke_invocation_create(ct.byref(invoke))
# set invocation properties
ni.navigator_invoke_invocation_set_action(invoke, b'bb.action.COMPOSE')
ni.navigator_invoke_invocation_set_type(invoke, b'message/rfc822')
def checkKeyExists(self, key):
data = yield self.getListOfData()
return key in data