Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

baali baali

🏠
Working from home
Block or report user

Report or block baali

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am baali on github.
  • I am baali (https://keybase.io/baali) on keybase.
  • I have a public key whose fingerprint is F891 136A 3FFB 0C7A B11E CDB5 5DB9 B0A6 8529 E773

To claim this, I am signing this object:

@baali
baali / MajorClust.py
Last active May 28, 2016
MajorClust algorithm implementation using sklearn based on SO conversation about text clustering using python(http://stackoverflow.com/questions/1789254/clustering-text-in-python).
View MajorClust.py
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
import numpy as np
from itertools import combinations
from random import shuffle
def majorclust_sklearn():
texts = [
"foo blub baz",
"foo bar baz",
@baali
baali / noiseLevels.py
Last active Jun 6, 2016
Python script to plot amplitude of noise levels
View noiseLevels.py
import sys
import audioop
try:
import pyaudio
except ImportError:
sys.exit('You need to install pyaudio to installed to run this demo.')
SAMPLING_RATE = 22050
NUM_SAMPLES = 1024
line = None
@baali
baali / pySpeechToText.py
Created Mar 19, 2013
Google Speech to Text Api usage in Python
View pySpeechToText.py
# based on http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/
# needs pyaudio package http://people.csail.mit.edu/hubert/pyaudio/
# Linux based, sox commands to convert from way to flac format.
import pyaudio
import wave
import subprocess, shlex
CHUNK = 1024
FORMAT = pyaudio.paInt16
@baali
baali / rot-n.py
Created Feb 3, 2013
Decryption of Rot-n encoded message
View rot-n.py
# usage python rot-n.py encodedeMessage n
# python rot-n.py "Va gur ryringbef, gur rkgebireg ybbxf ng gur BGURE thl'f fubrf." 13
import sys
if __name__ == '__main__':
encodedMsg = sys.argv[1]
n = int(sys.argv[2])
# lets make everything lower case
encodedMsg = encodedMsg.lower()
decodedMsg = ''
View swear.py
def swear(self, mess, args):
"swears randomley from a list of high level swear words"
swears = ["neech","kameen","kuttey", "howley", "saaley", "monkey", " kaachina vennela to tea pettukune mohavu nuvvu nu ","thitlu adukkunne mohamu nuvvoonu ", " currentu teegaki uyyala eskune ooge mohavu nuvvu" , "donkey", "vudathalu patte mokam", "chapathi mokam", "washbasin lo chepalu patte mokam", "gaali vaanalo visnakarrlu ammukune mokam", "Chunchu mokam", "ghootley", "jaffa", "tussha", "daffa", "jumper mein bumper", "panther pagdi" ,"lapaki paapa" ]
from random import choice
self.message_queue.append(choice(swears)+ " " + choice(swears) + " " + choice(swears) + " "+ args)
@baali
baali / convert.py
Created Aug 30, 2012
TO convert YUV422 to YUV444 and eventually RGB format jpg file
View convert.py
import vision_definitions
import numpy
import time
import Image
camProxy = ALProxy("ALVideoDevice", NAO_IP, PORT)
t0 = time.time()
# block to capture image from NAO's camera with 640x480 resolution and YUV422 colorspace
client = camProxy.subscribe("client", vision_definitions.kVGA, vision_definitions.kYUV422ColorSpace, 5)
@baali
baali / dump_file.cpp
Created Aug 24, 2012
DebugProtocol to print payload in human redable form.
View dump_file.cpp
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@baali
baali / fileComparison.py
Created May 13, 2012
To check for duplicate files
View fileComparison.py
if bool(fileName):
flag = 1
filePath = os.path.join(detach_dir, 'attachments', fileName)
if not os.path.isfile(filePath) :
print fileName
fp = open(filePath, 'wb')
fp.write(part.get_payload(decode=True))
fp.close()
else:
tmpPath = os.path.join(detach_dir, 'attachments', fileName+'tmp')
@baali
baali / dlAttachments.py
Created May 8, 2012
Python script to download all gmail attachments.
View dlAttachments.py
# Something in lines of http://stackoverflow.com/questions/348630/how-can-i-download-all-emails-with-attachments-from-gmail
# Make sure you have IMAP enabled in your gmail settings.
# Right now it won't download same file name twice even if their contents are different.
import email
import getpass, imaplib
import os
import sys
detach_dir = '.'
You can’t perform that action at this time.