Skip to content

Instantly share code, notes, and snippets.

Avatar

Kedar Mhaswade kedarmhaswade

  • JyMob
  • Sunnyvale, USA
View GitHub Profile
@kedarmhaswade
kedarmhaswade / devanagari-based-multi-lingual-template.tex
Last active Mar 27, 2021
A basic smartphone-viewable template for devanagari based articles typeset for different (Indic) languages. Uses velthuis encoding for 7-bit ASCII transliteration.
View devanagari-based-multi-lingual-template.tex
% 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 / elements.txt
Created Aug 2, 2020
118 elements from the modern periodic table: name, symbol, atomic number
View elements.txt
Hydrogen,H,1
Helium,He,2
Lithium,Li,3
Beryllium,Be,4
Boron,B,5
Carbon,C,6
Nitrogen,N,7
Oxygen,O,8
Fluorine,F,9
Neon,Ne,10
View mathematical_creation.md

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 Apr 22, 2019
A method call expression results in a value, not an automatic variable (that should appear on the lhs of an assignment statement)
View ValueIsNotVariable.java
class ValueIsNotVariable {
static int get() {
return 10;
}
static void inc() {
get() += 1;
}
}
/**
➜ Java javac Assign.java
@kedarmhaswade
kedarmhaswade / .psudo
Last active Feb 8, 2019
A simple, but mysterious function
View .psudo
// 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 Jan 18, 2019
A naive circular buffer ...
View queue.go
// 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 Feb 12, 2017 — 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
View DirectMemorySize.java
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 Apr 23, 2016 — forked from rednaxelafx/PrintThreadIds.java
find out the correspondence between the tid/nid of Java threads as shown from jstack/JMX, on HotSpot/Linux
View PrintThreadIds.java
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 Apr 6, 2016
How to make a JAR!
View foo.txt
➜ /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 Apr 5, 2016
Does Java Use the right IP version?
View Tmp.java
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.