Skip to content

Instantly share code, notes, and snippets.

View avinash-mishra's full-sized avatar
🎯
Focusing

Avinash avinash-mishra

🎯
Focusing
View GitHub Profile
@bellbind
bellbind / getscreenshot.py
Created June 29, 2009 15:50
[python][pywebkitgtk]Get web page screenshot
#
# Get web page screenshot
#
# usage:
# xvfb-run -s "-screen 0 1024x768x24" python getschreenshot.py test.html
#
# libs:
# - pygtk: http://www.pygtk.org/
# - pywebkitgtk(python-webkit): http://code.google.com/p/pywebkitgtk/
# - PIL: http://www.pythonware.com/products/pil/
@seanh
seanh / gist:232821
Created November 12, 2009 11:11
Creating and removing files and directories with Python os module
"""This is done with the os module, which has lots of methods for handling files and dirs.
<http://docs.python.org/lib/os-file-dir.html>
Effbot's page on the os module: <http://effbot.org/librarybook/os.htm>
The shutil module is useful here also: <http://docs.python.org/lib/module-shutil.html>
"""
import os
@mlafeldt
mlafeldt / scp_demo.py
Created February 24, 2011 09:09
[Python] paramiko examples
#!/usr/bin/env python
import sys, paramiko
if len(sys.argv) < 5:
print "args missing"
sys.exit(1)
hostname = sys.argv[1]
password = sys.argv[2]
@marcelcaraciolo
marcelcaraciolo / tf_idf_final.py
Created January 13, 2012 03:38
tf-idf example
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')
@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@superdaigo
superdaigo / zabbix-alert-smtp.sh
Created September 20, 2012 04:58
Zabbix SMTP Alert script for gmail
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Zabbix SMTP Alert script for gmail.
"""
import sys
import smtplib
from email.MIMEText import MIMEText
from email.Header import Header
@anubhavsinha
anubhavsinha / excel2mysql.py
Created September 29, 2012 00:29
simple excel to mysql in python
# following Python packages needs to be installed
# xlrd, xlsxrd, unidecode, MySQLdb
import xlrd
import xlsxrd
import MySQLdb as mdb
import re
import unidecode
@dergachev
dergachev / README.md
Created October 10, 2012 16:49
Vagrant tutorial

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

@solar
solar / install.sh
Created October 16, 2012 18:06
install mysqld with supervisord
#!/bin/sh
sudo groupadd mysql
sudo mkdir -p /var/mysqld
sudo useradd -r -g mysql -M -d /var/mysqld mysql
sudo chown mysql:mysql /var/mysqld
sudo yum -y install cmake bison gcc-c++
curl -sL http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.28.tar.gz | tar zx
cd mysql-5.5.28/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/5.5.28 -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_bin
@fnielsen
fnielsen / afinn.py
Last active May 6, 2021 11:41
Simplest sentiment analysis in Python with AFINN
#!/usr/bin/python
#
# (originally entered at https://gist.github.com/1035399)
#
# License: GPLv3
#
# To download the AFINN word list do:
# wget http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6010/zip/imm6010.zip
# unzip imm6010.zip
#