Skip to content

Instantly share code, notes, and snippets.

@pankajp
pankajp / prof.stat
Last active January 8, 2023 23:10
prof_viewer.ipynb
�)�S/home/pankaj/code/pyenv/lib64/python3.11/site-packages/pandas/core/dtypes/dtypes.pyi7� PeriodDtype)�rg���>g���V-?{��~��*<built-in method builtins.__build_class__>)rrg���>g���V-?0)�/usr/lib64/python3.11/copy.py�B�copy)rrg(&e&�>gu�����>{��U/home/pankaj/code/pyenv/lib64/python3.11/site-packages/pandas/compat/pickle_compat.pyr�<module>)rrg(&e&�>gu�����>0)�!/usr/lib64/python3.11/warnings.pyi�� __enter__)� rg9?�>�>g���{�?{��O/home/pankaj/code/pyenv/lib64/python3.11/site-packages/pandas/_config/config.py�� _set_option)�rg�G�xP�>gA��H���>��R/home/pankaj/code/pyenv/lib64/python3.11/site-packages/pandas/core/indexes/base.pyi�� _with_infer)�rg?K6V�>g�+8�/6�>0)�#/usr/lib64/python3.11/re/_parser.pyi��
_parse_sub)�1�gh�Q�3G?g ����?{�ri��parse)rrg����B4?g ����?�ri��_parse)�_�4g�:�%:?g:����Rz?0)r��filterwarnings)�r&g���d� ?gqc���=J?{��
@pankajp
pankajp / caching_mod.py
Created December 8, 2018 17:37
Python module level property and cached property decorator
from mod_prop import mod_property, cached_mod_property
@mod_property
def my_prop():
print('my_prop called')
return 42
@cached_mod_property
def my_cached_prop():
@pankajp
pankajp / serve_http.py
Last active October 19, 2024 11:58
Simple Python HTTP Server with multi-threading and partial-content support
#! /usr/bin/env python
# Standard library imports.
from SocketServer import ThreadingMixIn
import BaseHTTPServer
import SimpleHTTPServer
import sys
import json
import os
from os.path import (join, exists, dirname, abspath, isabs, sep, walk, splitext,
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
@pankajp
pankajp / qtextinsert.py
Created July 1, 2013 19:41
The performance effect of text overflow in a QPlainTextEdit with setMaximumBlockCount set.
from pyface.qt import QtGui, QtCore
import time
import pandas
import numpy
from matplotlib import pyplot as plt
a = QtGui.QApplication.instance() or QtGui.QApplication([])
w = QtGui.QPlainTextEdit()
w.setMinimumSize(600, 400)
@pankajp
pankajp / traits_tree_editor_icon_change.py
Created December 5, 2012 06:58
Dynamically change the icon of a tree node in Traits TreeEditor
from traits.api import *
from traitsui.api import *
global_count = 0
class TNode(TreeNodeObject):
count = 0
files = List
label = Str
something = Int
@pankajp
pankajp / cssify.js
Created October 22, 2012 14:17 — forked from Dither/cssify.js
Convert XPath to CSS selector
// JavaScript function for converting simple XPath to CSS selector.
// Ported by Dither from [cssify](https://github.com/santiycr/cssify)
// Example: `cssify('//div[@id="girl"][2]/span[@class="body"]//a[contains(@class, "sexy")]//img[1]')`
var sub_regexes = {
"tag": "([a-zA-Z][a-zA-Z0-9]{0,10}|\\*)",
"attribute": "[.a-zA-Z_:][-\\w:.]*(\\(\\))?)",
"value": "\\s*[\\w/:][-/\\w\\s,:;.]*"
};