Skip to content

Instantly share code, notes, and snippets.

View debugger22's full-sized avatar

Sudhanshu Mishra debugger22

View GitHub Profile
@debugger22
debugger22 / min_bounding_circle_radius.go
Created October 29, 2023 14:19
Calculate minimum bounding circle radius for geolocation coordinates using Welzl's algorithm
package helpers
import (
"math"
"math/rand"
)
type Point struct {
Lat, Lng float64
}
func startRedisListener() {
ctx, cancelFn = context.WithCancel(context.Background())
defer cancelFn()
onUserChannelMessage(ctx, r, w)
for {
// ...do usual stuff
}
}
func onUserChannelMessage(ctx context.Context, r <-chan *redis.Message, w chan string) {
func onUserChannelMessage(r <-chan *redis.Message, w chan string) {
go func() {
for m := range r {
w <- m.Payload
}
}()
}
@debugger22
debugger22 / admin.py
Created September 11, 2017 07:52 — forked from mariocesar/admin.py
Django admin decorator to create a confirmation form action, like the default delete action works
from .models import Post, Category
from .decorators import action_form
class PostCategoryForm(forms.Form):
title = 'Update category for the selected posts'
category = forms.ModelChoiceField(queryset=Category.objects.all())
@admin.register(Post)
@debugger22
debugger22 / test_report.md
Last active August 29, 2015 14:23
Time and memory consumption report

When Symbol is modified

Line #    Mem usage    Increment   Line Contents
================================================
     6     30.2 MiB      0.0 MiB   @profile
     7                             def mem_test():
     8     30.5 MiB      0.3 MiB       _syms = [Symbol('x_' + str(i), real=True, positive=True) for i in range(1, 101)]
     9     34.7 MiB      4.2 MiB       for i in _syms:
@debugger22
debugger22 / sym_mod.html
Created June 29, 2015 14:27
sym_mod.html
<html>
<head>
<style>.frame {
margin-left: 0;
font-size: 10pt;
border-left: 1px solid #eee;
padding-left: 15px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAALCAMAAAB8rpxtAAAARVBMVEUAAAD9/f5xe4R1fYZ1fIf////O0NWzs7OysrJ2fYh2fYh2fIf///+FjJaxtbv////n6Or///+VmqP///92fYh5gYyCiJLu0pBqAAAAFHRSTlMAghs7SSu2CgTirXMj/M9EnhHqZ/jLwbwAAABGSURBVAjXY0ABHOxQwAHkMIqJQAAnkMPKBuWwgNQJC4HZXGBNggKiIA4TxAh+PiCbG2YeI68IJwfMdB42EWaEXawsDJgAACnNA3xj5yn5AAAAAElFTkSuQmCC);
background-repeat: no-repeat;
@debugger22
debugger22 / satask_mod.html
Created June 29, 2015 14:26
satask_mod.html
<html>
<head>
<style>.frame {
margin-left: 0;
font-size: 10pt;
border-left: 1px solid #eee;
padding-left: 15px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAALCAMAAAB8rpxtAAAARVBMVEUAAAD9/f5xe4R1fYZ1fIf////O0NWzs7OysrJ2fYh2fYh2fIf///+FjJaxtbv////n6Or///+VmqP///92fYh5gYyCiJLu0pBqAAAAFHRSTlMAghs7SSu2CgTirXMj/M9EnhHqZ/jLwbwAAABGSURBVAjXY0ABHOxQwAHkMIqJQAAnkMPKBuWwgNQJC4HZXGBNggKiIA4TxAh+PiCbG2YeI68IJwfMdB42EWaEXawsDJgAACnNA3xj5yn5AAAAAElFTkSuQmCC);
background-repeat: no-repeat;
@debugger22
debugger22 / ask_mod.html
Created June 29, 2015 14:24
ask_mod.html
<html>
<head>
<style>.frame {
margin-left: 0;
font-size: 10pt;
border-left: 1px solid #eee;
padding-left: 15px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAALCAMAAAB8rpxtAAAARVBMVEUAAAD9/f5xe4R1fYZ1fIf////O0NWzs7OysrJ2fYh2fYh2fIf///+FjJaxtbv////n6Or///+VmqP///92fYh5gYyCiJLu0pBqAAAAFHRSTlMAghs7SSu2CgTirXMj/M9EnhHqZ/jLwbwAAABGSURBVAjXY0ABHOxQwAHkMIqJQAAnkMPKBuWwgNQJC4HZXGBNggKiIA4TxAh+PiCbG2YeI68IJwfMdB42EWaEXawsDJgAACnNA3xj5yn5AAAAAElFTkSuQmCC);
background-repeat: no-repeat;
@debugger22
debugger22 / symbol.diff
Created June 23, 2015 11:14
Modify Symbol to add assumptions to global assumptions
commit de49998cc22c1873799539237d6202134a463956
Author: Sudhanshu Mishra <mrsud94@gmail.com>
Date: Tue Jun 23 16:35:13 2015 +0530
Symbol creation adds provided assumptions to global assumptions
diff --git a/sympy/core/symbol.py b/sympy/core/symbol.py
index 3945fa1..45be26d 100644
--- a/sympy/core/symbol.py
+++ b/sympy/core/symbol.py
<li class="icon icon-arrow-left">
<a href="#">Services</a>
<div class="mp-level">
<h2 class="icon icon-display">Services</h2>
<a class="mp-back" href="#">Back</a>
<ul>
<li>
<a target="_blank" href="http://10.1.1.222/cms/">Complaint Portal</a>
</li>
<li>