Skip to content

Instantly share code, notes, and snippets.

View vipul-sharma20's full-sized avatar
💭
doin werrk

Vipul vipul-sharma20

💭
doin werrk
View GitHub Profile
@vipul-sharma20
vipul-sharma20 / python_objects.py
Last active March 25, 2016 16:27
Objects everywhere
>>> a = 10
>>> a.__class__
<type 'int'>
>>>
>>>
>>> '10'.__class__
<type 'str'>
>>>
>>>
>>>True.__class__
@vipul-sharma20
vipul-sharma20 / nested.py
Created March 26, 2016 05:12
Python's nest
def wrapper():
wrapper_a = 10
def inner():
print wrapper_a
return inner
wrapper()
"""
Output:
10
# borrowed this example from http://thecodeship.com/patterns/guide-to-python-function-decorators/
def get_text(name):
return "lorem ipsum, {0} dolor sit amet".format(name)
def p_decorate(func):
def func_wrapper(name):
return "<p>{0}</p>".format(func(name))
return func_wrapper
my_get_text = p_decorate(get_text)
def p_decorate(func):
def func_wrapper(name):
return "<p>{0}</p>".format(func(name))
return func_wrapper
@p_decorate
def get_text(name):
return "lorem ipsum, {0} dolor sit amet".format(name)
print get_text("Vipul")
@vipul-sharma20
vipul-sharma20 / bluetooth-a2dp
Last active September 17, 2017 14:15 — forked from ragusa87/bluetooth-a2dp
Enable bluetooth A2DP on Raspberry-PI via pulseaudio.To install, edit /etc/udev/rules.d/99-input.rules and add the line:SUBSYSTEM=="bluetooth", RUN+="/usr/lib/udev/bluetooth"Then save this script as /usr/lib/udev/bluetooth and set it executable.Bluetooth devices must be linked first.
#!/bin/bash
# This script is called by udev when you link a bluetooth device with your computer
# It's called to add or remove the device from pulseaudio
#
#
# Output to this file
LOGFILE="/var/log/bluetooth_dev"
# Name of the local sink in this computer
@vipul-sharma20
vipul-sharma20 / tesseract.py
Last active January 31, 2017 20:33
very minimal tesseract's python wrapper (requires Python 3.6+)
# Segmentation modes
OSD = 0 # OSD only
AUTOMATIC_OSD = 1 # Automatic page segmentation with OSD
AUTOMATIC_NO_OSD = 2 # Automatic page segmentation, but no OSD, or OCR
DEFAULT = 3 # Fully automatic page segmentation, but no OSD. (Default)
BLOCK_VERTICAL_VARIABLE = 4 # Assume a single column of text of variable sizes.
BLOCK_VERTICAL_UNIFORM = 5 # Assume a single uniform block of vertically aligned text.
BLOCK_SINGLE = 6 # Assume a single uniform block of text.
SINGLE_LINE = 7 # Treat the image as a single text line.
SINGLE_WORD = 8 # Treat the image as a single word.
@vipul-sharma20
vipul-sharma20 / install-output.txt
Last active February 4, 2017 07:35
OpenCV 3.2 cmake output
-- General configuration for OpenCV 3.2.0 =====================================
-- Version control: unknown
--
-- Platform:
-- Timestamp: 2017-02-03T10:55:22Z
-- Host: Darwin 14.0.0 x86_64
-- CMake: 3.7.2
-- CMake generator: Unix Makefiles
-- CMake build tool: /usr/bin/make
-- Configuration: RELEASE
@vipul-sharma20
vipul-sharma20 / vim-install.md
Created February 4, 2017 07:37
compile vim with python support
  • git clone https://github.com/vim/vim.git
  • cd vim
  • ./configure --with-features=huge --enable-perlinterp=yes --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-multibyte
  • make
  • make install
{
"Ansi 6 Color" : {
"Green Component" : 0.7333333492279053,
"Red Component" : 0,
"Blue Component" : 0.7333333492279053
},
"Tags" : [
],
"Ansi 12 Color" : {
diff --git a/Python/ceval.c b/Python/ceval.c
index 4e4adc2d63..b02425ea5a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -662,6 +662,7 @@ static int _Py_TracingPossible = 0;
per thread, now just a pair o' globals */
int _Py_CheckInterval = 100;
volatile int _Py_Ticker = 0; /* so that we hit a "tick" first thing */
+volatile int _Py_Ticker_Count = 0;