Skip to content

Instantly share code, notes, and snippets.

View anudeepsamaiya's full-sized avatar
:bowtie:
Always ready!

Anudeep Samaiya anudeepsamaiya

:bowtie:
Always ready!
View GitHub Profile
@anudeepsamaiya
anudeepsamaiya / LearnGoIn5mins.md
Created January 16, 2021 09:08 — forked from prologic/LearnGoIn5mins.md
Learn Go in ~5mins
@anudeepsamaiya
anudeepsamaiya / README
Created January 16, 2021 09:08 — forked from miraculixx/README
Celery worker blocks on rate limited task
Celery worker blocks on rate limited task
=========================================
by github.com/miraculixx
Problem:
If a worker has a rate_limit active on some task, and that task
arrives (is received) more often than the rate limit interval, all
worker processes will block on these task instances and stop
consuming other tasks as soon as the prefetch count has maxed out
@anudeepsamaiya
anudeepsamaiya / celery_task_monitor.py
Created January 16, 2021 09:08 — forked from linar-jether/celery_task_monitor.py
Celery task monitor, logs task state to MongoDB
import pickle
import threading
from Queue import Queue
import time
from bson import InvalidDocument
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
@anudeepsamaiya
anudeepsamaiya / makemigrations.py
Created January 16, 2021 09:08 — forked from r3m0t/makemigrations.py
Migration conflict file
# coding: utf-8
"""Cause git to detect a merge conflict when two branches have migrations."""
# myapp/management/commands/makemigrations.py
# you'll need myapp/management/commands/__init__.py and myapp/management/__init__.py in PY2, see Django docs
from __future__ import absolute_import, unicode_literals
import io
import os
import six
@anudeepsamaiya
anudeepsamaiya / introrx.md
Created May 23, 2016 09:41 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@anudeepsamaiya
anudeepsamaiya / volley-POST-example.java
Created May 21, 2016 17:53 — forked from mombrea/volley-POST-example.java
Example of performing a POST request using Google Volley for Android
public static void postNewComment(Context context,final UserAccount userAccount,final String comment,final int blogId,final int postId){
mPostCommentResponse.requestStarted();
RequestQueue queue = Volley.newRequestQueue(context);
StringRequest sr = new StringRequest(Request.Method.POST,"http://api.someservice.com/post/comment", new Response.Listener<String>() {
@Override
public void onResponse(String response) {
mPostCommentResponse.requestCompleted();
}
}, new Response.ErrorListener() {
@Override
@anudeepsamaiya
anudeepsamaiya / CircleAnimatedCheckBox.java
Created May 8, 2016 01:55 — forked from cesco89/CircleAnimatedCheckBox.java
A custom animated circle checkbox based on markushi's CircleButton (https://github.com/markushi/android-circlebutton)
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.CheckBox;
import android.widget.ImageView;
@anudeepsamaiya
anudeepsamaiya / Readme.md
Created October 26, 2015 16:51 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@anudeepsamaiya
anudeepsamaiya / themes-debug.xml
Created October 22, 2015 09:42 — forked from dlew/themes-debug.xml
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"