Skip to content

Instantly share code, notes, and snippets.

View mmpataki's full-sized avatar

Madhusoodan Pataki mmpataki

View GitHub Profile
@mmpataki
mmpataki / MyAgent.java
Last active August 27, 2020 10:28
Blog: JVM agents and JIT
package com.mmp.jvmtiperf;
import javax.crypto.spec.*;
import java.lang.instrument.Instrumentation;
import java.security.spec.*;
import java.util.Base64;
import javax.crypto.*;
public class MyAgent {
@mmpataki
mmpataki / novpn.py
Last active August 27, 2020 10:28
FB term
import signal
import subprocess
from fbchat import Client
from fbchat.models import *
user = "F1_user_email"
passwd = "F1_user_password"
recvFrom = "F2_user_id"
client = None
@mmpataki
mmpataki / test.ipynb
Last active January 4, 2021 03:21
a ipynb test
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<html>
<body>
<style>
.storyboard-content { padding: 10px; }
.storyboard-titlebar { padding: 10px 0px; }
.storyboard-errmsg { color: red; }
.storyboard-title { font-weight: bolder; font-size: 1.1em; }
input, select { display: block; margin: 5px 10px; padding: 5px; min-width: 200px; }
button { padding: 5px 10px; margin-right: 10px; }
@mmpataki
mmpataki / render.js
Last active May 14, 2021 13:31
render
function render(name, spec, elemCreated, container) {
let e;
if (!spec.preBuilt) {
e = document.createElement(spec.ele);
spec.iden && elemCreated(spec.iden, e)
if (spec.text) e.innerHTML = spec.text;
if (spec.classList) {
e.classList = `${name}-` + spec.classList.split(/\s+/).join(` ${name}-`)
}
spec.attribs && Object.keys(spec.attribs).forEach(key => {
@mmpataki
mmpataki / AadharDetailsStory.js
Created May 14, 2021 13:47
storyteller pattern
class AadharDetailsStory {
constructor(args) { this.args = args; }
title() { return "Enter your Aadhar ID" }
moral() { return { ...this.args, aadharid: this.aadharid.value } }
async isCompleted() { return this.aadharid.value && this.aadharid.value.length == 12 }
getQuestions() { return "Enter a valid aadhar id" }
nextStoryName() { return OTPVerifyStory }
preDestroy() { this.status.innerText = 'validating aadhar details...'; return new Promise(res => setTimeout(() => res(), 1000)) }
tell() {
return render('aadhar', {
@mmpataki
mmpataki / tabs.html
Created July 4, 2021 07:25
HTML Tabs
<html>
<style>
.tabh1 + label, .tabh2 + label, .tabh3 + label { padding: 2px 8px; border: solid 1px lightgray; display: inline-block; border-bottom: none; }
.tabh1:checked + label, .tabh2:checked + label, .tabh3:checked + label { background: olivedrab; }
.tabh1, .tabh2, .tabh3 { display: none;}
.tabc1, .tabc2, .tabc3 { display: none; padding: 20px; border: solid 1px lightgray;}
.tabh1:checked ~ .tabc1, .tabh2:checked ~ .tabc2, .tabh3:checked ~ .tabc3 { display: block; }
</style>
<div>
<input id='th1' type='radio' name='tswitcher' class='tabh1' checked></input>
@mmpataki
mmpataki / Dish.java
Last active July 28, 2021 07:57
Updateable Mongo Store
/*
* Model to be stored
*/
public class Dish extends Updateable {
String name;
String originCountry;
String recipe;
public Dish(String name, String originCountry, String recipe) {
@mmpataki
mmpataki / ia4jgen.js
Last active April 25, 2022 13:51
Ia4j gen
// ==UserScript==
// @name ia4jgen
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Generate ia4j snippets from the opengrok
// @author Madhusoodan
// @match http://psvglapp01:8080/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
package com.example;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.Date;
import java.util.stream.LongStream;
public class TimeServer {
public static void main(String[] args) throws IOException {