Skip to content

Instantly share code, notes, and snippets.

View kedarmhaswade's full-sized avatar
💭
Just trying to catch up with my calendar

Kedar Mhaswade kedarmhaswade

💭
Just trying to catch up with my calendar
  • JyMob
  • Sunnyvale, USA
View GitHub Profile
@kedarmhaswade
kedarmhaswade / devanagari-based-multi-lingual-template.tex
Last active March 27, 2021 09:45
A basic smartphone-viewable template for devanagari based articles typeset for different (Indic) languages. Uses velthuis encoding for 7-bit ASCII transliteration.
% Thanks to: https://tex.stackexchange.com/q/565173/64425
\documentclass[a6paper]{article}
\usepackage{geometry}
\geometry{
bottom=20mm,
left=5mm,
right=5mm,
}
\usepackage{polyglossia}
@kedarmhaswade
kedarmhaswade / .ruby-gemset
Last active February 22, 2021 13:49
Learning SQL (O'Reilly) With SQLite instead of MySQL
global

Mathematical Creation

How is mathematics made? What sort of brain is it that can compose the propositions and systems of mathematics? How do the mental processes of the geometer or algebraist compare with those of the musician, the poet, the painter, the chess player? In mathematical creation which are the key elements? Intuition? An exquisite sense of space and time? The precision of a calculating machine? A powerful memory? Formidable skill in following complex logical sequences? A supreme capacity for concentration?

The essay below, delivered in the first years of this century as a lecture before the Psychological Society in Paris, is the most celebrated of the attempts to describe what goes on in the mathematician's brain. Its author, Henri Poincaré, cousin of Raymond, the politician, was peculiarly fitted to undertake the task. One of the foremost mathematicians of all time, unrivaled as an analyst and mathematical physicist, Poincaré was known also as a brilliantly lucid expositor of the philosophy

@kedarmhaswade
kedarmhaswade / ValueIsNotVariable.java
Created April 22, 2019 02:08
A method call expression results in a value, not an automatic variable (that should appear on the lhs of an assignment statement)
class ValueIsNotVariable {
static int get() {
return 10;
}
static void inc() {
get() += 1;
}
}
/**
➜ Java javac Assign.java
@kedarmhaswade
kedarmhaswade / .psudo
Last active February 8, 2019 05:53
A simple, but mysterious function
// This is simply some pseudo code; applicable to any programming language that has support for
// basic data types and recursive functions
// Two questions:
// 1- Solve the "mystery": what does the function do?
// 2- Enhance the function to accommodate other integers.
function mystery(int a, int b) {
if (b == 1) {
return a
}
return mystery(a, b - 1) + a
@kedarmhaswade
kedarmhaswade / queue.go
Last active January 18, 2019 02:15
A naive circular buffer ...
// A naive circular buffer ...
type CircularBuffer struct {
buf []int
cap, head, tail int
}
func (q *CircularBuffer) add(d int) error {
if q.tail-q.head > q.cap {
return errors.New("buffer full")
}
@kedarmhaswade
kedarmhaswade / DirectMemorySize.java
Created February 12, 2017 13:50 — forked from rednaxelafx/DirectMemorySize.java
An Serviceability-Agent based tool to see stats of NIO direct memory, as an alternative on JDK6 without JMX support for direct memory monitoring. Only works on JDK6; to work on JDK7 will need some tweaking because static variables are moved to Java mirror
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.tools.*;
import sun.jvm.hotspot.utilities.*;
public class DirectMemorySize extends Tool {
@kedarmhaswade
kedarmhaswade / PrintThreadIds.java
Created April 23, 2016 13:42 — forked from rednaxelafx/PrintThreadIds.java
find out the correspondence between the tid/nid of Java threads as shown from jstack/JMX, on HotSpot/Linux
package fx.jvm.hotspot.tools;
import java.util.List;
import sun.jvm.hotspot.tools.Tool;
public class PrintThreadIds extends Tool {
public static void main(String[] args) {
PrintThreadIds tool = new PrintThreadIds();
tool.start(args);
@kedarmhaswade
kedarmhaswade / foo.txt
Created April 6, 2016 01:48
How to make a JAR!
➜ /tmp tree com
com
└── test
└── Test.java
1 directory, 2 files
➜ /tmp more com/test/Test.java
package com.test;
class Test {
@kedarmhaswade
kedarmhaswade / Tmp.java
Created April 5, 2016 00:12
Does Java Use the right IP version?
package tmp;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
/**
* Created by kmhaswade on 3/31/16.