Skip to content

Instantly share code, notes, and snippets.

View ajoyoommen's full-sized avatar

Ajoy Oommen ajoyoommen

View GitHub Profile
@ajoyoommen
ajoyoommen / Launcher.java
Last active February 12, 2019 06:25
Run a python application from within Java. These methods use Jython (which does not support python 3) and Runtime
package com.project.pythonIntegration;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.util.Properties;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
@ajoyoommen
ajoyoommen / push_and_recieve_from_sqs.py
Created November 20, 2018 07:09
This script will push data into a queue and poll from the queue until there are no more messages.
import boto3
import json
sqs = boto3.client('sqs', region_name='us-east-1')
queue = 'https://sqs.us-east-1.amazonaws.com/93423423423/boto-queue'
def push_to_queue(data, attrs):
@ajoyoommen
ajoyoommen / graph_chess_com.py
Last active May 28, 2018 07:43
Plots the games won, lost and drawn by a player in different game formats. Save PGN files from chess.com into a folder `pgn/`. Requires `matplotlib`.
from datetime import datetime
import os
import re
import sys
import matplotlib.pyplot as plt
USER = "ajoy"
DIRNAME = 'pgn/'
@ajoyoommen
ajoyoommen / delete_tweets.py
Created May 22, 2018 07:56
Script to delete all tweets and favorites for a user.
import os
import tweepy
consumer_key = os.environ['CONSUMER_KEY']
consumer_secret = os.environ['CONSUMER_SECRET']
access_token = os.environ['ACCESS_TOKEN']
access_token_secret = os.environ['ACCESS_TOKEN_SECRET']
@ajoyoommen
ajoyoommen / wordcloud.py
Created May 21, 2018 18:08
This program will fetch tweets from you Twitter timeline and generate a wordcloud
import tweepy
from wordcloud import WordCloud
import matplotlib.pyplot as plt
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
[user]
name = Full Name
email = email@website.com
[alias]
summary = log --oneline --decorate --branches --graph
summary-authors = log --graph --branches --format='%C(auto)%h%C(blue)<%ae>%Cgreen%ar%Creset %C(auto)%d%Creset%s'
csv = log --all --format='%H,%P,%ae,%aI,"%s"'
[core]
editor = emacs -nw
@ajoyoommen
ajoyoommen / pedantically_commented_playbook.yml
Created March 20, 2017 05:22 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@ajoyoommen
ajoyoommen / indian_states_cities.json
Created November 18, 2016 06:29
A Django DB dump of list of 1216 cities and 34 states (including union territories) in India
[
{
"model": "stores.state",
"pk": 1,
"fields": {
"country": 1,
"name": "Delhi"
}
},
{
@ajoyoommen
ajoyoommen / emacs.el
Created October 7, 2016 09:00
Emacs configuration files
;; Disbale CTRL Z
(global-unset-key (kbd "C-z"))
;; Show line number and column number at bottom
(setq line-number-mode t)
(setq column-number-mode t)
;; setup package repositories
(when (>= emacs-major-version 24)
(require 'package)
@ajoyoommen
ajoyoommen / kill.sh
Last active December 22, 2023 20:03
Kill gunicorn daemon
kill -9 `ps aux |grep gunicorn |grep projectname | awk '{ print $2 }'`