Skip to content

Instantly share code, notes, and snippets.

View siddharth96's full-sized avatar

Siddharth Srivastava siddharth96

View GitHub Profile
@siddharth96
siddharth96 / pykafka_logs.log
Last active January 19, 2017 10:55
PyKafka logs with use_rdkafka=True
[2017-01-19 14:47:43,002 DEBUG T:MainThread F:_debug] | Worker: Starting Pool
[2017-01-19 14:47:43,010 DEBUG T:MainThread F:start] ^-- substep ok
[2017-01-19 14:47:43,011 DEBUG T:MainThread F:_debug] | Worker: Starting Consumer
[2017-01-19 14:47:43,011 DEBUG T:MainThread F:_debug] | Consumer: Starting Connection
[2017-01-19 14:47:43,017 INFO T:MainThread F:start] Connected to pykafka://guest:guest@<ip>:2181//,pykafka://guest:guest@<ip>:2181//,pykafka://guest:guest@<ip>:2181//
[2017-01-19 14:47:43,017 DEBUG T:MainThread F:start] ^-- substep ok
[2017-01-19 14:47:43,017 DEBUG T:MainThread F:_debug] | Consumer: Starting Events
[2017-01-19 14:47:43,021 DEBUG T:MainThread F:start] ^-- substep ok
[2017-01-19 14:47:43,021 DEBUG T:MainThread F:_debug] | Consumer: Starting Tasks
[2017-01-19 14:47:43,027 DEBUG T:MainThread F:update] Updating cluster, attempt 1/3
@siddharth96
siddharth96 / kafka_transport.py
Created January 19, 2017 10:04
Celery based Kafka consumer
"""
kombu.transport.kafka
=====================
Kafka transport.
:copyright: (c) 2010 - 2013 by Mahendra M.
:license: BSD, see LICENSE for more details.
**Synopsis**
@siddharth96
siddharth96 / PhpJava.java
Created September 1, 2016 17:11 — forked from avafloww/PhpJava.java
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@siddharth96
siddharth96 / pie_chart_palette
Last active September 29, 2021 17:10
Generate color palettes for PieChart (Android)
public int[] getPieChartColors(int numPieSlices, int baseColor,
boolean adjacentColors) {
// Inspiration http://stackoverflow.com/a/19389478
int[] colors = new int[numPieSlices];
colors[0] = baseColor;
float hsv[] = new float[3];
Color.RGBToHSV(Color.red(baseColor), Color.green(baseColor), Color.blue(baseColor),
hsv);
double step = (240.0 / (double) numPieSlices);
@siddharth96
siddharth96 / create_thumb
Last active August 29, 2015 14:05
Python script to create image thumbnails while preserving Aspect ratio
import PIL
from os import listdir
from os.path import isfile, join
from PIL import Image
directory_path = "<some directory>"
onlyfiles = [ f for f in listdir(directory_path) if isfile(join(directory_path,f)) ]
basewidth = 64